I've been looking through the forums and such on EE and just can't seem to piece together the right syntax for this bcp routine. I am simply trying to write the results of a stored procedure to a text file with each field being seperated by a comma.
This is what I have so far:
declare @bcp varchar(8000)
SET @bcp = 'exec UPS_EnrollmentFileTest queryout' + 'C:\text.text' + '" -U sa -P password -c -t,'
EXEC master..xp_cmdshell @bcp
When I run this in query analyzer I get an error that returns as if it were a table with 3 rows. It reads:
row 1: 'exec' is not recognized as an internal or external command,
row 2: operable program or batch file.
row 3: null
If anyone could point me in the right direction I would really appreciate it.