[英]How can I automate the “generate scripts” task in SQL Server Management Studio 2008?
[英]Can I automatically 'Generate Scripts' in a SQL Server 2005 task?
我想定期自动生成数据库脚本。 这可能吗。
要为对象生成脚本,您必须传递最多六个参数:
exec proc_genscript
@ServerName = 'Server Name',
@DBName = 'Database Name',
@ObjectName = 'Object Name to generate script for',
@ObjectType = 'Object Type',
@TableName = 'Parent table name for index and trigger',
@ScriptFile = 'File name to save the script'
http://www.databasejournal.com/features/mssql/article.php/2205291
您可能想查看 SQL Server 管理对象 (SMO)。 有一些脚本对象可以帮助从数据库对象生成 T-SQL 脚本。 Bill Hamilton 的“Programming SQL Server 2005”是一个很好的参考。 第 12 章特别提到了 SMO 实用程序类。
您可以使用CodePlex中的数据库发布向导 。 它有一个命令行界面。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.