[ACCEPTED]-Are indexes on temporary tables deleted when the table is deleted?-temp-tables

Accepted answer
Score: 24

Yes they are. You can search in MSSQL help 4 for CREATE INDEX article it is said there:

"Indexes 3 can be created on a temporary table. When 2 the table is dropped or the session ends, all 1 indexes and triggers are dropped."

Score: 6

It will be removed automatically, as there 2 is nothing left to index. Think of it as 1 a child object in this respect.

Score: 2

The drop table will remove the index. Drop 4 Index takes the index name and the table 3 name.

In this case would be DROP INDEX idc 2 ON #tbl

which can be called if you want to 1 drop the index but leave the table.

More Related questions