Move a table from one database to another database SQL Server

后端 未结 3 1026
天涯浪人
天涯浪人 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:36

    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

提交回复
热议问题