//
you're reading...
Microsoft SQL

Copy A Table From One Database To Another In MS SQL 2008

This can be useful if you’ve just restored a database from backup under a different name to the live database, and need to copy only individual tables and the table data from the restored database to the live one.

Lets assume that the live database is called Live_DB and the restored database is called Restored_Live_DB and you want to copy the table My_Table_1 and all its data from the restored database to the live one

The following script will do this, just replace the database and table names as required

USE Restored_Live_DB
SELECT *
INTO Live_DB.dbo.My_Table_1
FROM Restored_Live_DB.dbo.My_Table_1

Lee

Discussion

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

%d bloggers like this: