Wait for an Agent job to finish by polling its current sysjobactivity row, enforcing a timeout, and checking sysjobhistory outcome.
SQL SERVER – Backup and Restore Database Using Command Prompt – SQLCMD
Good DBAs automate the boring work. Here is a simple script to run Backup and Restore of a database from the command prompt with SQLCMD.
SQL SERVER – Generate Random Values – SQL in Sixty Seconds #042 – Video
There are many ways to generate random values in SQL Server. In this sixty second video I show a neat trick to get a random value between two numbers.
Warning Before SQL Login Passwords Expire With DaysUntilExpiration
A Friday-night login failure is avoidable. One small query warns you weeks ahead, if somebody owns the warning.
SQL SERVER – Difference Between NOLOCK and NOWAIT Hints
Should you use NOLOCK when NOWAIT errors out on a lock? Here is the difference between NOLOCK and NOWAIT, and why neither guarantees a valid answer.
SQL SERVER – Significance of Table Input Parameter to Stored Procedure
Pass a whole table into a stored procedure instead of forming and parsing XML. Here is why a table input parameter to stored procedure saves round trips.
SQL SERVER – How to Use Instead of Trigger
Triggers come in two kinds, Instead of and After. Here is how an Instead of Trigger can intercept an insert, update or delete on a table, with an example.







