15 December,2014 by Tom Collins
Question: How can I use bcp to export and import data on SQL Server ?
Answer: Use the syntax in the examples below to Import and Export using bcp
bcp "[MyDatabase].dbo.MyTable" out "MyTable.bcp" -N -S ServerName -T -E -U"xxxxxx" -P"xxxxxxx"
--using a SQL Username and Password
bcp "[MyDatabase].dbo.MyTable" in "MyTable.bcp" -N -S ServerName -T -E -b 10000 -U"xxxxxx" -P"xxxxxxx"
These examples use the bcp native format which is a binary format. It is possible that characters in the results may be unreadable.
The workaround for unreadable characters is to use a) character format i.e –c if there is no Unicode data or b) if Unicode exists use -w
SQL Server – Export Excel data to SQL Server with Powershell
How to output Query results to text file using bcp and queryout
This is only a preview. Your comment has not yet been posted.
As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.
Having trouble reading this image? View an alternate.
Posted by: |