Identify foreign keys that aren’t trusted

Foreign Keys (FK) need to be in a trusted state to be used by the SQL Server query. So, if an FK is not trusted, the SQL query optimizer will not be able to build better execution plans without it. So, run the following For…

Locks, Blocks and Deadlocks

Read another great blog from Brent Ozar regarding the fundamentals around transaction locking. Sometimes diagnosing locking problems can be confusing, but Brent has a good way of explaining what each term means, which therefore helps you to understand how to reach a solution! Query Tuning…

List all heap tables

So, when a table does not have an index on it, it is considered a heap table. To find these tables, use the following script

Shutdown a computer via remote connection

If you’re connecting to a computer using Remote Desktop (RDP), sometimes you are not given the option to shutdown from the Start menu. So instead, you can use command prompt to access a Shutdown option directly. Click Start, click All Programs, click Accessories, and click…

Update command with a join

A while back, I showed how you can use a Delete command in conjunction with a join. Note that you can also use this when performing an Update! So, use this handy approach if your update is conditional on data from another table.