INSERT INTO from two different server database

后端 未结 5 1965
走了就别回头了
走了就别回头了 2021-02-02 10:07

I am trying to copy the data of testdabse.invoice table to basecampdev.invoice table. testdabse is a local database while basecampde

5条回答
  •  灰色年华
    2021-02-02 10:26

    You cannot directly copy a table into a destination server database from a different database if source db is not in your linked servers. But one way is possible that, generate scripts (schema with data) of the desired table into one table temporarily in the source server DB, then execute the script in the destination server DB to create a table with your data. Finally use INSERT INTO [DESTINATION_TABLE] select * from [TEMPORARY_SOURCE_TABLE]. After getting the data into your destination table drop the temporary one.

    I found this solution when I faced the same situation. Hope this helps you too.

提交回复
热议问题