Bulk copy export in SQL using queryout

sql sqlbulkcopy sql-server-2008

Question

I am testing a simple syntax for Bulk Copy export - Output file is a Flat File with tab delimiter (either in SQL Server 2008 or 2012).

Somehow my command is throwing a syntax error on queryout:

bcp "SELECT * FROM DatabaseLog" queryout "C:\Test\TestingBulkCopy.txt" -t\t -c -T

Popular Answer

BCP is a command-line utility. You need to run it for an OS command prompt rather than from a T-SQL session.



Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why