Move a table from one database to another database SQL Server

后端 未结 3 1066
天涯浪人
天涯浪人 2021-02-07 01:59

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

3条回答
  •  轮回少年
    2021-02-07 02:43

    With help of my office friends , this is the solution I figured out.

    1. In object Explorer , go to source database and select table to move.

    2. 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.

    3. You can change table name in CREATE TABLE section and make other changes...

    4. Change database name in first line USE to Target database and execute the the query.

    Thanks.

提交回复
热议问题