使用c#完成数据库脚本 [英] Complete script of database using c#

查看:63
本文介绍了使用c#完成数据库脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我正在尝试使用c#生成带有架构和数据的数据库脚本。我可以获得像table,storedProcedure这样的单个部分的脚本......但这不是一个好方法。



任何人都可以建议一个好的方法它。



谢谢。

解决方案

请参阅 - SMO脚本整个数据库,如Studio Management,使用生成脚本 [ ^ ]。

引用:

看看 http://scriptdb.codeplex.com

这是一个编写数据库ddl脚本的工具。

对于Scrripting数据,你可以尝试这里描述的方法: http://sqlblog.com/blogs /ben_miller/archive/2007/10/18/scripting-tables-views-and-data-using-smo-part-3.aspx 或尝试使用bcp,这对于更大的数据库来说是更好的选择。


Hi,

I am trying to generate script of database with schema and data using c#. I am able to get the script for individual portions like table , storedProcedure ... but it is not a good way.

Can anyone please suggest a good method for doing it.

Thanks.

解决方案

Refer - SMO scripting entire database like Studio Management does with Generate Scripts[^].

Quote:

Have a look at http://scriptdb.codeplex.com.
This is a tool that scripts out a Database's ddl.

For Scrripting out the data you could try an approach like described here: http://sqlblog.com/blogs/ben_miller/archive/2007/10/18/scripting-tables-views-and-data-using-smo-part-3.aspx or try to use bcp, wich would be the better alternative for bigger databases.


这篇关于使用c#完成数据库脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆