David Smith

David Smith

  • NA
  • 2k
  • 0

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

Mar 28 2012 9:20 AM
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