|My first T-SQL project
||[Sep. 4th, 2008|11:18 pm]
It's only a page, but it's my first serious T-SQL project. It uses current system objects (tables/views/etc.) to find how badly fragmented your indexes are. It shows the fragmentation on the clustered indexes (these are the ones that you need de-fragged the most), and also reports on the worst fragmentation on any non-clustered index. That way, if your clustered index is <5% fragmented (which means "don't bother defragging"), but you have a really badly fragged non-clustered index, you'll know. (You won't know which index, but you'll know to check them all.)
And, can I say, wow.
Programming in SQL is very different from programming in anything else. You have to think about sets and how to combine them, and just the simplest of errors can mean you miss crucial data, or end up repeating useful data so many times it becomes unreadable.