Archive

Posts Tagged ‘sql server’

Backup MS SQL Table

February 16th, 2010 No comments

Recently, i worked with MS SQL Server and i needed to backup a table. With Mysql database, this is a simple job. Infact , i think  that  mysqldump is very simple and quickly method. SQL Server provide with Management Studio an automatic backup also easy to use, but this permit to backup only the entire Db. After some google search i found the solution, bcp command, follow a sample.

For backup a table from my db i wrote :

bcp mydb.mytable OUT c:\export.txt -n -S dbserver  -T

and to restore :

bcp mydb.mytable IN c:\import.txt -n -S dbserver -T

Where the parameters :

-n  -> maintains the native type of the table

-S  -> the db server

-T  -> trusted connection

There are many other options, see the image below.

ww