To find the data type of an expression in SQL Server, pass it to SQL_VARIANT_PROPERTY or describe the whole query with sys.dm_exec_describe_first_result_set. This post tests both on a percentage calculation, shows how precision and scale come out, and explains why 2147483647 plus 1 fails.
Does NOLOCK Really Applies No Lock? – Interview Question of the Week #209
Does NOLOCK really applies no lock? No. NOLOCK takes a Sch-S, or schema stability, lock. Here is a simple script to see it for yourself.
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.
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.





