Thursday, January 17, 2008

[Maintenance] system tables part 1 - find non-indexed foreign keys (2005)

Fortunately for me, there's a lot of other SQL Server bloggers - so before I write code, I go see if someone's already written it. No sense reinventing the wheel, after all. Thanks go out to Michael Smith for writing this. What's interesting is that he doesn't use any of the DMVs, just the "sys." tables (sys.foreign_keys, sys.foreign_key_columns, sys.indexes, sys.index_columns). I may rewrite this at some point to include a CREATE for those missing ones.

Find Unindexed Foreign Keys (2005) (you may need to click on the link - blogger seems to be cutting off the end)
http://www.sqlservercentral.com/scripts/Index+Management/31980/

No comments: