Last Updated: February 25, 2016
· purekrome

Exporting/Importing from a Microsoft Sql Server table


bcp <database table> out <filename> -T -S <server name> -c
bcp <database table> out <filename> -U <username> -P <password> -S <server name> -c


bcp xwing.dbo.Users out "C:\temp\" -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.


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.