To disable row goal for one query, add the DISABLE_OPTIMIZER_ROWGOAL hint to it. This post builds a table where the row goal chooses a bad plan, shows the reads with and without the hint, and then shows a table where the row goal wins.
List All Sessions – SQL in Sixty Seconds #148
One of the most frequent questions which I receive from my client is about activity going inside SQL Server and how to list all sessions.
Attach an In-Memory Database With T-SQL: Include the Container
To attach an In-Memory database with T-SQL, use CREATE DATABASE with FOR ATTACH and list the data file, the log file and, when it moved, the container folder. This post builds a demo database, detaches it and attaches it twice. It also shows which rows survive.
SQL SERVER – Attach a Database with T-SQL
To attach a Database with T-SQL, I use CREATE DATABASE … FOR ATTACH. A customer asked about attaching existing data and log files.
Capture sp_who2 Output Into a Table With INSERT EXEC
To capture sp_who2 output, create a table with matching columns and fill it with INSERT EXEC. This post builds the table, captures the session list three times with a time stamp, and shows the two errors that stop the method.
DMV Version of sp_who2: A Cleaner Session List
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.
Line Numbers for SSMS Efficiency – SQL in Sixty Seconds #147
This is when the line numbers in SSMS comes in extremely handy and let us learn in today’s blog post how we can do that. Let us learn today.







