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
You might want to look at the SQL Server Management Objects (SMO). There are objects for scripting that will assist in generating T-SQL scripts from database objects. A good reference for this is "Programming SQL Server 2005" by Bill Hamilton. Chapter 12 in particular references the SMO utility classes.
You can use the Database Publishing Wizard , from CodePlex. It has a command-line interface.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.