Re-using Key values (finding the gaps)


Suppose you do physical deletes of data and are in a position to re-use the 'keys' for a table. You can use the technique below to find gaps in the key for your table (assuming you are using a single numerical key). -- LET'S USE TEMPDBUSE tempdb;GO -- DROP THE TABLE IF IT ALREADY EXISTSIF …

SQL Server 2005: INCLUDE argument with Nonclustered Indexes.


There is a new INCLUDE argument available in SQL Server 2005 when creating nonclustered indexes. According to the MSDN documentation, INCLUDE is used to: Specify the nonkey columns to be added to the leaf level of the nonclustered index. In a nutshell, this new clause allows us to better target columns we need in a …

Some New Books – bring on the learning…


I bought two new books today: Inside Microsoft SQL Server 2005: T-SQL Querying and Inside SQL Server 2005: T-SQL Programming, both by Itzik Ben-Gan. I spent a morning in one of his Black Hat SQL sessions a few years ago and have been following his works ever since. I've started with T-SQL Querying as it's …