Spatial database queries are my favorite subject since TechEd India 2010. Here are the scripts to build the environment, plus a question: what about BLOB?
SQL SERVER – Size of Index Table for Each Index – Solution 3 – Powershell Index Size
Laerte Junior fixed my Powershell setup remotely in minutes and sent solution 3 to my puzzle on the size of each index. Here is his Powershell Index Size answer.
SQL SERVER – Size of Index Table for Each Index – Solution 2
A second solution to my size of index table puzzle: Rama Mathanmohan’s query sums used pages from sys.allocation_units to give each index size in KB.
Finding the First Monday of Every Month in T-SQL
Calculate the first Monday without DATEFIRST, list a full year, find nth and last weekdays, and reuse the rules in an inline table function.
SQL SERVER – Get Latest SQL Query for Sessions – DMV
Want the latest SQL query for sessions on your server? Join sys.dm_exec_connections with sys.dm_exec_sql_text using most_recent_sql_handle.
SQL SERVER – SHRINKFILE and TRUNCATE Log File in SQL Server 2008
A reader’s job failed after upgrading to SQL Server 2008 because TRUNCATE_ONLY is gone. My notes on SHRINKFILE and TRUNCATE Log File, and what to watch for.
SQL SERVER – Attach mdf file without ldf file in Database
A friend sent me only his mdf file instead of a backup of the database. Here is how to attach mdf file without ldf file and let SQL Server build a new log.







