Hi there,
Straight to the point I have the following code in a stored procedure:
DECLARE @FilePath VARCHAR(500) DECLARE @SQL VARCHAR(500) SET @SQL='SELECT * FROM blah blah;' SET @FilePath='C:\blah\blah.csv' SET @SQL='SQLCMD -E -Q "SET NOCOUNT ON; '+@SQL+'" -o "'+@FilePath+'" -h-1 -s "," -W' -- -h-1 for no header -- if remove -h-1 then 1 header -- -h1 then after every row there is header and so on EXEC master..xp_cmdshell @SQL END
It runs okay and produces no errors, gives the result output NULL and Return Value 0. Its as though its worked but I get nothing on the network? Any one any idea's?
:)