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.
Finding Old Agent Jobs Not Run in Months or Never Scheduled
Review agent jobs not run recently or lacking schedules, combine history and activity, and disable approved candidates for review.
Convert Integer to Date in SQL Server: ddMMyyyy Values
To convert integer to date values such as 09122020, split the number into day, month and year and build the date from the parts. This post compares four methods on tested data, shows why a lost leading zero and the session language break two of them, and times them on a million rows.
Top N Plus Others: Grouping the Rest Into One Row
Create top N plus others summaries with deterministic category ranking, one remainder total, stable labels, and explicit display ordering.
SQL SERVER – Change Database and Table Collation
To Change Database collation, I separate its default from existing character-column settings. The customer moved from case-insensitive to case-sensitive behavior.







