MS SQL Server with management studio - 如何用数据编写表(作为插入语句)?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9499986/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
MS SQL Server with management studio - how to script a table with its data (as insert statements)?
提问by JL.
Possible Duplicate:
Get script of SQL Server data
可能的重复:
获取 SQL Server 数据的脚本
I want to move some rows from 1 table (on one server) to another (on another server).
我想将一些行从 1 个表(在一台服务器上)移动到另一个(在另一台服务器上)。
The table schema is the same, what I need to do is generate some insert statements. Is there a way to do this using some built in / best practice way?
表模式是一样的,我需要做的是生成一些插入语句。有没有办法使用一些内置/最佳实践方式来做到这一点?
Import / Export seems completely extreme and excessive.
进口/出口似乎完全极端和过度。
Thanks in advance.
提前致谢。
回答by Anthony Faull
Right-click on the database name and choose Tasks-> Generate Scripts. On the Scripting Optionsscreen set Script Datato true.
右键单击数据库名称并选择Tasks-> Generate Scripts。在脚本选项屏幕上,将脚本数据设置为 true。
回答by Arion
You can do it with the publish wizard
您可以使用发布向导来完成
Maybe it's well-known, but new to me, you can just run “C:\Program Files (x86)\Microsoft SQL Server\90\Tools\Publishing\1.4\SqlPubWiz.exe”. This nifty little tool can generate INSERT script very easily.
也许它是众所周知的,但对我来说是新的,你可以运行“C:\Program Files (x86)\Microsoft SQL Server\90\Tools\Publishing\1.4\SqlPubWiz.exe”。这个漂亮的小工具可以很容易地生成 INSERT 脚本。
Reference here
参考这里