Category: Troubleshooting
-
JSON in SQL Server: OPENJSON, FOR JSON, and the Native JSON Type
SQL Server has had JSON functions since 2016, and SQL Server 2025 added a native JSON data type on top of them. Most write-ups explain the syntax; fewer show what actually differs between storing JSON as text and storing it as the native type, or when reaching for JSON in a relational database is the…
Written by
-
Diagnose SQL Server’s ‘String or Binary Data Would Be Truncated’ Error
🚨Part of the SQL Server Errors series, the exact messages and what actually causes them. Msg 2628 · Level 16 · State 1 · Msg 8152 · Level 16 · State 30 Msg 2628: String or binary data would be truncated in table ‘SalesDemo.dbo.TruncTest’, column ‘code’. Truncated value: ‘TOOLO’. Msg 8152: String or binary data…
Written by
-
Shrinking a SQL Server Database Causes Fragmentation: Measured, Not Just Stated
How to Shrink SQL Server Database Files in Chunks already says it plainly in its common pitfalls: shrinking causes index fragmentation, every time. That’s correct, and worth taking on faith from someone who’s had to clean up after it. It’s more useful with a real number attached. This post runs the actual before/after: a lab…
Written by
-
DBCC CHECKDB Found Corruption: What to Actually Do Next
DBCC CHECKDB reporting consistency errors is one of the few moments in this job that deserves to feel urgent. It usually also arrives with no warm-up: a query that worked yesterday throws a 5-digit error number nobody recognizes, or a scheduled DBCC CHECKDB job that’s passed silently for years suddenly doesn’t. This post reproduces a…
Written by
-
Parameter Sniffing in SQL Server: A Measured Example, Not Just the Theory
Parameter sniffing is SQL Server doing exactly what it’s supposed to do: compiling a query plan based on the actual parameter value passed in the first time it runs, then reusing that plan for later calls. That’s normally the right behavior, a plan built for the real value is usually better than a generic one.…
Written by
-
Table Variables vs Temp Tables in SQL Server: What the Optimizer Actually Sees
The usual line on table variables vs temp tables is “table variables don’t have statistics, so the optimizer assumes 1 row.” That was true once. It isn’t the whole story on a current SQL Server, and the actual gap between what the optimizer assumes and what’s really there is worth measuring rather than repeating from…
Written by
-
Troubleshoot “Login Failed for User” (Error 18456) in SQL Server
🚨Part of the SQL Server Errors series, the exact messages and what actually causes them. Error 18456 is the most common login failure in SQL Server, and the message you get is deliberately vague: Msg 18456 · Severity 14 Login failed for user ‘domain\user’. (Microsoft SQL Server, Error: 18456) ⚡The client normally receives only the…
Written by
-
Unable to Open the Physical File (Error 5120)
SQL Server error 5120 reports an operating system error, and error 5 has two completely different causes: the file is already open, or the service account cannot read it. The message cannot tell them apart.
Written by
-
Troubleshoot RESOURCE_SEMAPHORE Waits in SQL Server (Memory Grant Pressure)
⏳Part of the SQL Server Wait Types Library, every wait type explained.Related pillar: Performance & Troubleshooting RESOURCE_SEMAPHORE means a query is waiting for a workspace memory grant, memory SQL Server reserves up front for sorts, hashes, and other operators before the query is allowed to run at all, and there isn’t enough available right now.…
Written by
-
Fix “Msg 207: Invalid Column Name” in SQL Server
🚨Part of the SQL Server Errors series, the exact messages and what actually causes them. Msg 207 · Level 16 · State 1 Invalid column name ‘X’. ⚡The column does not exist in the context the query is running in. Before assuming a typo, check you are on the database you think you are on,…
Written by
- Set the Default Database for a SQL Server Login
- SQL Server High CPU: What to Check First, in Order
- Cannot Connect to SQL Server: The Checks in the Order That Finds It
- Cumulative Wait Stats Lie: Measuring Waits Over an Interval
- SQL Server Differential vs Log Backup: Which One Restores What, and How the Chain Breaks
- SQL Server MAXDOP and Cost Threshold: What To Set, and Why 5 Is Not a Recommendation
- Backups & Recovery (17)
- DBA Scripts (150)
- High Availability (HA) (12)
- Installation & Configuration (45)
- Maintenance (24)
- Migration & Upgrades (14)
- Monitoring (9)
- Performance Tuning (37)
- Security (Encryption & Permissions) (19)
- Storage & Capacity (14)
- T-SQL Fundamentals (11)
- Troubleshooting (65)
- Wait Types (235)