Export database from one SQL Server to another SQL Server Export database from one SQL Server to another SQL Server database database

Export database from one SQL Server to another SQL Server


Easiest Way

Backup the database in SSMS, and then restore the database on the target machine.

To do this in SSMS (SQL Server Management Studio), right click the database you want to backup select Tasks->Backup, note the type of backup and the path of the .bak file. Then grab that file (the .bak) and go to the target database server / machine. Right click databases and do a "Restore".

Here you can tell it the path of the .bak file, and the database will be created on your clients machine with the name you specify.

Harder But Reusable Way

If you really feel geeky you can write some T-SQL to backup and restore the database as well. Let me know if you feel real geeky and we can go this route as well...but it appears you are only doing this once so scripting is probably some overkill. But just in case anyone needs to backup a database, you can throw this in a procedure if you want:

DECLARE @strRootPath varchar(50)DECLARE @BackupFile varchar(100)DECLARE @strDB varchar(25)SELECT @strRootPath = 'C:\SQL_BACKUPS\MyDBFolder\'SELECT @strDB = db_name()SELECT @BackupFile =       @strRootPath    + db_name()    + '_'    + CONVERT(varchar(8), GetDate(), 112)               -- yyyymmdd    + '_'    + REPLACE(LEFT(CONVERT(varchar(8), GetDate(), 108), 5), ':', '')    -- hh:mm:ss    + '.BAK'BACKUP DATABASE @strDB TO  DISK =@BackupFile WITH RETAINDAYS = 10, NAME = N'MyDB_DATA-Full Database Backup', STATS = 10BACKUP LOG MyDB   TO MyDB_Log;


or maybe you can use SQL Server Management Studio (SSMS) then right click on database that you want to export so you will get new window for export-import database. fill any information for database connection and follow the steps until you success export it :)