SQL Azure - copy table between databases

后端 未结 12 2360
天命终不由人
天命终不由人 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

    You can easily add a "Linked Server" from SQL Management Studio and then query on the fully qualified table name. No need for flat files or export tables. This method also works for on-prem to azure database and vice versa.

    e.g.

    select top 1 ColA, ColB from [AZURE01_]._UAT_RecoveryTestSrc.dbo.FooTable order by 1 desc
    
    select top 1 ColA, ColB from [AZURE01_]._UAT_RecoveryTestTgt.dbo.FooTable order by 1 desc
    

提交回复
热议问题