[英]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.