Can I automatically generate scripts in a SQL Server 2005 task?

I would like to automatically generate database scripts on a regular basis. Is it possible.

+4
source share
3 answers

To generate a script for an object, you must 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

+7
source

You might want to take a look at SQL Server Management Objects (SMOs). There are scripting objects that can help generate T-SQL scripts from database objects. A good reference for this is Bill Hamilton's SQL Server 2005 Programming . Chapter 12, in particular, lists the classes for the SMO utility.

0
source

You can use the Database Publishing Wizard from CodePlex. It has a command line interface.

0
source

Source: https://habr.com/ru/post/1276868/


All Articles