I'd like to automatically generate database scripts on a regular basis. Is this possible.
+4
A:
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
Orion Adrian
2008-09-18 14:53:26
A:
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.
DaveCrawford
2008-09-18 14:55:34
A:
You can use the Database Publishing Wizard, from CodePlex. It has a command-line interface.
santiiiii
2008-09-18 15:05:55