Monthly Archives: January 2010

Stored Procedure to Sequentially Run SQL Agent Jobs

Here is another one of my utility scripts. Lately it seems like all I am blogging about lately is utility scripts, but I have a ton of them and need to get them documented. This stored procedure is used to run a series of SQL Agent jobs sequentially. It is one of my favorite stored procedures because it clears up a lot of headaches for me without having to spend a bunch of money or turn my maintenance schedules over to another team. Continue reading

Posted in Utilities | Tagged | 4 Comments

Stored Procedure to Get SQL Job Execution Status

Ever need a programmatic way to figure out if a SQL Agent job is running? I did. After spending a while searching on Google I did not turn up anything I liked so I turned to Profiler and started looking at what calls SQL Management Studio uses. After a bit of poking around I was able to come up with a stored procedure that I could call. Continue reading

Posted in Utilities | Tagged , , , , , , | Leave a comment

Using sp_ExecuteSql to Run Dynamic SQL

Dynamic SQL should be considered a highly specialized tool of last resort and used properly. Misuse can lead to your server and the data stored on it no longer belonging to you. Continue reading

Posted in Dynamic SQL, Security | Tagged | Leave a comment