Tuesday, December 2, 2014

bcp command to write a file syntax question

Or you can use three part name for your table name:


SET @bcpCommand='bcp "SELECT * FROM yourDB.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