在asp.net中备份sql c# [英] back up sql in asp.net c#
本文介绍了在asp.net中备份sql c#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我们从管理工作室为sql数据库生成脚本时,它会生成数据库的脚本...
如何通过sql命令生成在线数据库的帽子脚本....
i发现它使.bak ...但是如何制作sql脚本。 。
when ever we generate script for a sql database from the management studio its generate a script of the database...
how to generate hat script of an online database by sql command....
i found to make it .bak...but how to make sql script..
推荐答案
SQL脚本存储在syscomments表中,您可以使用sys_objects和syscomments中的Object_ID和ID连接syscomments。针对每个proc或函数或视图获取脚本。
SQL Script are stored in syscomments table you can join the syscomments with sys.objects on Object_ID and ID in syscomments. To get the script against each proc or function or views.
select
Object_ID,TEXT
from
Sys.Objects Obj
Join SysComments comm On Obj.Object_id=comm.Id
注意,如果脚本太长,你可以对ID使用多行文本。
note, you can have multiple line of Text against an ID if the script is too long.
sqlcmd不允许你这样做。
也许您可以尝试使用Powershell。
欲了解更多信息,请查看以下链接:
http:// blogs .technet.com / b / heyscriptingguy / archive / 2010/11/04 / use-powershell-to-script-sql-database-objects.aspx [ ^ ]
sqlcmd does not allow you to do that.
Maybe you can try with Powershell.
For more information, check this link:
http://blogs.technet.com/b/heyscriptingguy/archive/2010/11/04/use-powershell-to-script-sql-database-objects.aspx[^]
嗨。,
浏览以下链接。你会得到一些想法:
http://www.mssqltips.com/sqlservertip/1833/generate-scripts-for-database-objects-with-smo-for-sql-server/ 一> [ ^ ]
用于脚本化SQL Server数据库对象的库,带有示例 [ ^ ]
http://stackoverflow.com/questions/12140422/generating-sql-script-through-code-c-net [ ^ ]
Hi.,
Go through the following Links. You will get some Idea:
http://www.mssqltips.com/sqlservertip/1833/generate-scripts-for-database-objects-with-smo-for-sql-server/[^]
Library for scripting SQL Server database objects with examples[^]
http://stackoverflow.com/questions/12140422/generating-sql-script-through-code-c-net[^]
这篇关于在asp.net中备份sql c#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文