I have a database DB_1
which has an empty table T1
with 5 columns.
I want to move this table to another database DB_2
on the same
In SQL Server Management Studio
you have Import and Export Wizard
:
DB_2
)DB_1
)DB_2
)copy data from one ore more tables
T1
)If the databases are on same server then do it like this,
select * into DB_2.T1 from DB_1.[dbo].[T1]
if you have databases on different servers than you have to create a linked server.
On second thought you can generate "create tables scripts" and run them on second database
With help of my office friends , this is the solution I figured out.
In object Explorer , go to source database and select table to move.
Right click , Script Table As -> CREATE TO -> New Query Editor Window. This opens query window with the SQL queries specifying schema , indexes , constraints on the table.
You can change table name in CREATE TABLE section and make other changes...
Change database name in first line USE <DATABASE>
to Target database and execute the the query.
Thanks.