Two reader solutions to my puzzle: queries that show the size of the index table for each index, accurate in nearly all of my tests.
DATEDIFF_BIG: Count Long Intervals Without int Overflow
DATEDIFF_BIG returns bigint boundary counts. Compare a long seconds interval, reversed dates and a tiny boundary crossing without overflowing int.
SQL SERVER – Comma Separated Values (CSV) from Table Column
The script I use most often to build Comma Separated Values (CSV) from a table column with FOR XML PATH. I think XML is the best option for code and speed.
SQL SERVER – Interesting Observation – TOP 100 PERCENT and ORDER BY
ORDER BY in a view raises Msg 1033 unless TOP is used, so many developers add TOP 100 PERCENT. An interesting observation on what that really does.
SQL SERVER – Understanding Table Hints with Examples
What are hints in SQL Server and when should you use them? Understanding table hints with examples, plus a word of caution about overriding the optimizer.
SQL SERVER – Size of Index Table – A Puzzle to Find Index Size for Each Index on Table
sp_spaceused shows the total index size of a table. My puzzle for you: write a query that adds the size of each index to the sys.indexes list.
smallmoney: Four Fractional Digits Need a Contract
smallmoney stores a bounded numeric amount with four fractional digits. These explicit conversions show retained and changed digits without making a financial storage recommendation.







