Want to create a script to export Data and tables and views to a sql script

后端 未结 7 1311
梦如初夏
梦如初夏 2021-02-05 03:26

Want to create a script to export Data and tables and views to a sql script.

I have SQL Server 2008 r2.

So far I\'ve only been able to automatically generate an

7条回答
  •  庸人自扰
    2021-02-05 04:19

    If you don't want to port all tables data (for example you need to port just some base data in special tables) scripting options is not useful for you. In this case you'll have two options. First is using some third parties tools such as Red-Gate and Second way is writing the script by yourself. I prefer Second option because except the expensive price of most of them i want to run just little script for little delete, update and inserting purpose. But the important problem is here: maybe the record count is too long to write scripts record by record. I Think the linked Server is good point to solve that. It's enough for describing Just Declare Linked Server as you see in Images and get new script in your source DB and write scripts with access to both source and destination DB. Attached image must be clear.

    Create New Linked Server:
    

    enter image description here

    Write Destination SQL Server Address:
    

    enter image description here

    Fill Login Info:
    

    enter image description here

    Now you have Linked Server:
    

    enter image description here

    Write script and enjoy:
    

    enter image description here

    Hope this help.

提交回复
热议问题