SQL Azure - copy table between databases

后端 未结 12 2362
天命终不由人
天命终不由人 2020-12-08 13:39

I am trying to run following SQL:

INSERT INTO Suppliers ( [SupplierID], [CompanyName]) 
Select  [SupplierID], [CompanyName] From [AlexDB]..Suppliers
<         


        
12条回答
  •  轮回少年
    2020-12-08 14:25

    Use the following steps, there is no straight forward way to do so. But by some trick we can.

    Step1 : Create another one table with the same structure of Suppliers table inside [AlexDB], Say it as SuppliersBackup

    Step2 : Create table with the same structure of Suppliers table inside DesiredDB

    Step3 : Enable Data Sync Between AlexDB..Suppliers and DesiredDB..Suppliers

    Step4 : Truncate data from AlexDB..Suppliers

    Step5 : Copy data from AlexDB..SuppliersBackup to AlexDB..Suppliers

    Step6 : Now run the sync

    Data Copied to DesiredDB.

提交回复
热议问题