I can’t for the life of me remember what the SQL (SQL Server 2005+) is to compact indexes after deletion i.e.
PK Identity col1 col2
1 abc def
3 abc def
id 2 has been deleted – whats the command to essentially compact the indexes while keeping referential integrity (there’s a one line statement)
Thanks, (and I know I’m going to ‘face-palm’ when I see the answer)
The term in SQL is Reorganizing and Rebuilding Indexes and the commands for each of these are:
and
But as per the opening line on that link “The SQL Server 2005 Database Engine automatically maintains indexes whenever insert, update, or delete operations are made to the underlying data.” so just leave it to the server.