Exporting/Importing from a Microsoft Sql Server table
Exporting
bcp <database table> out <filename> -T -S <server name> -c
bcp <database table> out <filename> -U <username> -P <password> -S <server name> -c
Eg.
bcp xwing.dbo.Users out "C:\temp\users.data" -T -S MyDatabaseServer -c
NOTE: the -T
means: Trusted connection. So this means the logged in user account's permissions will be used to communicate with the database.
Importing
bcp <database table> in <filename> -T -S <server name> -c
bcp <database table> in <filename> -U <username> -P <password> -S <server name> -c
Same as before, except it has an in
instead of an out
.
This will append to the end of the table. Not overwrite.
Written by Pure Krome
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Sql-server
Authors
purekrome
26.58K
lyndsysimon
1.141K
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#