[英]Can I automatically 'Generate Scripts' in a SQL Server 2005 task?
I'd like to automatically generate database scripts on a regular basis.我想定期自动生成数据库脚本。 Is this possible.
这可能吗。
To generate script for an object you have to pass up to six parameters:要为对象生成脚本,您必须传递最多六个参数:
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 http://www.databasejournal.com/features/mssql/article.php/2205291
You might want to look at the SQL Server Management Objects (SMO).您可能想查看 SQL Server 管理对象 (SMO)。 There are objects for scripting that will assist in generating T-SQL scripts from database objects.
有一些脚本对象可以帮助从数据库对象生成 T-SQL 脚本。 A good reference for this is "Programming SQL Server 2005" by Bill Hamilton.
Bill Hamilton 的“Programming SQL Server 2005”是一个很好的参考。 Chapter 12 in particular references the SMO utility classes.
第 12 章特别提到了 SMO 实用程序类。
You can use the Database Publishing Wizard , from CodePlex. 您可以使用CodePlex中的数据库发布向导 。 It has a command-line interface.
它有一个命令行界面。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.