A DMV version of sp_who2 returns the same session details from documented views and leaves out the system tasks. This post builds the query, shows why the old spid above 50 filter fails, and stores the result in a temporary table.
SQL SERVER – Logical Processing Order of the SELECT Statement
Logical Processing places DISTINCT before TOP in a SELECT statement. Questions after my video prompted this explanation.
SQL SERVER – TOP and DISTINCT – Epic Confusion – SQL in Sixty Seconds #141
DBAs from the client’s organization ended up an argument about how T-SQL works. The discussion was about the epic confusion about TOP and DISTINCT.
How to Write Efficient Query? – Interview Question of the Week #300
Question: How to Write Efficient Query?
Answer: There is no right or wrong answer to this question. Let us learn about it today.
Rewriting Correlated Subqueries as Window Functions
Replace correlated subqueries with windowed counts, dates, and running totals, preserve detail rows, and keep useful EXISTS filters.
Performance Challenge – Write Efficient Query – SQL in Sixty Seconds #140
Recently while working with my client I ended up in a very interesting situation where my client wanted me to write an Efficient Query.
Find Outdated Statistics – SQL in Sixty Seconds #137
Is it possible that your statistics are many years old but still are valid? It is difficult to find Outdated Statistics is not as easy as it seems.







