0
Answer

SQL SERVER 2008 : bcp command. not copying file to disk

David Smith

David Smith

12y
1.7k
1
Below when I executing the stored procedure in either code or in management studio 2008 it saids it copied successfully, But I am not for sure why its not writing the file to disk. can some please help me, I have been struggling with this for the pass few days.


USE [ColorDb]
GO

ALTER PROCEDURE [dbo].[prc_WriteTableToTextDelimitedFile]
(
  @FilePath VarChar(256)

)
AS
BEGIN

DECLARE @sql varchar(8000)

SET @sql = 'bcp "SELECT * FROM ColorDb.dbo.ColorTable" queryout "'+ @FilePath +'" -c -t; -T -SXXXXXXXXXXXX'

Print @sql

exec master..xp_cmdshell @sql

END

RETURN