Several Times We need to know How To Move Or Copy SqlServer Database Table Schema And Data From One DataBase to Another In Sql Server We can do it in following ways.
Method 1.
Open Sql Server management studio
Right Click on Database name > Tasks > Export Data.
Provide login credentials and Select Database
In next screen select database where table is to be copied
Copy data from one or more tables or views
check tables you want to copy
finish the wizard
Method 2.
We can write this query to copy tables.
If you want to copy all objects,indexes,triggers,constraints etc then do it as mentioned below.
Right click on DB name > Tasks > Generate Scripts
Click on Advance button and select Schema And Data From Type of Data to Script section
Hope this helps.
Method 1.
Open Sql Server management studio
Right Click on Database name > Tasks > Export Data.
Provide login credentials and Select Database
In next screen select database where table is to be copied
Copy data from one or more tables or views
check tables you want to copy
finish the wizard
Method 2.
We can write this query to copy tables.
SELECT * INTO DestinationDB.dbo.tableName FROM SourceDB.dbo.SourceTable
SELECT * INTO testDB.dbo.test FROM pubs.dbo.authors
This command only copies table schema and dataSELECT * INTO testDB.dbo.test FROM pubs.dbo.authors
If you want to copy all objects,indexes,triggers,constraints etc then do it as mentioned below.
Right click on DB name > Tasks > Generate Scripts
Click on Advance button and select Schema And Data From Type of Data to Script section
Hope this helps.
If you like this post than join us or share
0 comments:
Post a Comment