I have MS SQL server with several jobs. Sometimes I and my colleagues change task. I want to export jobs, like at automaticaly so that put in mercurial and store version of jobs.
I would also like to have a similar opportunity for stored procedures in the database
Sql-server – Automaticaly export Jobs and stored procedure from mssql server
sql serversql-server-2005
Related Topic
- Sql-server – Move stored procedures from one database to another in SQL Server
- Sql-server – How to execute msdb.dbo.sp_start_job from a stored procedure in user database in sql server 2005
- SQL Server – How to Dump Database to SQL Script
- Sql-server – Running a MS-SQL Server Stored Procedure from MS Access
- Security – Configure user login and stored procedures permissions on SQL Server
- Sql-server – How export database from mssql by using command line
Best Answer
Once you realize that SSMS is using SMO (Server Management Objects) to do the scripting, and that you can use SMO yourself directly through something like powershell, this sort of thing gets easy. For instance, here's scripting out all the jobs on your server (written in powershell):
This is the least fancy version in that it dumps it straight to your screen. Want fancier? Create a ScriptingOptions object and pass that to the
script()
method. That should get you started.