简体   繁体   English

SQL:如何通过T-SQL脚本移植SQL Server数据库

[英]SQL: How do I port sql server database via t-sql scripts

I have to port sql server (2008) database with t-sql scripts. 我必须使用t-sql脚本移植sql server(2008)数据库。 I can generate "create" script per each database object (stored procedure, table) from Sql Server Management Studio (though it looks to take much time) 我可以从Sql Server Management Studio中为每个数据库对象(存储过程,表)生成“创建”脚本(尽管它看起来需要很多时间)

How do I port data for tables? 如何移植表数据? I'd like to have scripts like that: 我想要这样的脚本:

INSERT INTO ... VALUES(...)
INSERT INTO ... VALUES(...)
INSERT INTO ... VALUES(...)
...

Can I generate such scripts from Sql Server Management Studio or is there some free 3'rd party utility for that? 我可以从Sql Server Management Studio中生成此类脚本,还是为此提供一些免费的3'rd party实用程序? (I guess there should be). (我想应该有)。

Thank you in advance! 先感谢您!

(免费的) SMS工具包插件可以为数据库生成插入脚本。

If you're going to be doing bulk inserts of data, I'd suggest using bulk insert. 如果您打算批量插入数据,建议您使用批量插入。 You can do the insert from T-SQL, but I prefer to use the bcp command line utility as I can do both the export and import with minimal change to the run line. 您可以从T-SQL进行插入,但是我更喜欢使用bcp命令行实用程序,因为我可以在对运行行进行最小更改的情况下进行导出和导入。 Oh... and it runs a lot faster than a bunch of insert statements. 哦,它的运行速度比一堆插入语句要快得多。 Have a look at the documentation and see if it fits your purposes. 查看文档 ,看看它是否符合您的目的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM