Your query has to be on the same line inside the command:
SET @bcpCommand = 'bcp "SELECT * FROM barcode.dbo.LotContainers WHERE barcode IN (SELECT barCode FROM ##Temp WHERE containerExpired = 1) ORDER BY barcode" queryout C:\TEMP\LotContainers_Log.txt -c -T'
EXEC master..xp_cmdshell @bcpCommand
No comments:
Post a Comment