Category: T-SQL

  • Dynamically getting the execution status of a SQL Server Agent Job

    This problem seems trivial but there is no straight forward way to get this information. If you have tried the INSERT into EXEC command to insert the results of the sp_help_job procedure into a temporary table like below then you are familiar with the below error. insert into #jobstatus execute msdb..sp_help_job Msg 8164, Level 16, […]

  • Script to drop all objects of a Schema in SQL Server

    I have spent almost 3 hours to complete this script and test it for couple of sample scenarios during this weekend (31/01/10).  It drops all objects of a schema and then drops the schema itself. The script automatically takes care of all the object dependencies with in the schema by dropping all of its objects […]