A linked server query with OPENQUERY gave Msg 8180: Statement(s) could not be prepared. Deferred prepare could not be completed. Here is what I learned and the fix.
How to Move Log File or MDF File in SQL Server? – Interview Question of the Week #208
Question: How to Move Log File or MDF File in SQL Server? Here are the steps I use to move a busy LDF or MDF file to a quieter drive.
Finding Free Time Slots in a Calendar With GENERATE_SERIES
Find free time slots with GENERATE_SERIES, exclude overlapping bookings, and merge busy intervals before calculating calendar gaps.
SQL SERVER – Copy Data From SSMS Query Result to Excel
How do you copy data from an SSMS query result to Excel? It is simple, but not everyone knows it: right-click the results and save them as a CSV file.
Clear the Plan Cache for a Single Database in SQL Server
To clear the plan cache for one database, use ALTER DATABASE SCOPED CONFIGURATION CLEAR PROCEDURE_CACHE in that database. This post tests it on two small databases, compares it with DBCC FLUSHPROCINDB and with freeing a single plan, and explains why DBCC FREEPROCCACHE is a bad habit.
Reduce IO Waits in SQL Server: Read the Waits First
To reduce IO waits in SQL Server, first name the wait. This post explains the main IO wait types and measures two of them for a single session on a demo database. It then shows how to check file latency and which fix matches each wait.





