Search This Blog

Using BCP to Import and Export Data

BCP (Bulk Copy Program) is shipped with SQL Server and enables you to quickly import or export large amounts of data.

Export Data:

bcp "Select col1, col2 from database.schema.table1 order by col1" queryout table1.txt -c -T 

Import Data (must have table with correct data types to import into):

bcp anotherdatabase.schema.mytable in table1.txt -T -c 

Arguments I have used:

-T = use trusted connection
-c = bcp is being used with character data

No comments:

Post a Comment