Do I need to drop index on temp table?
Fairly simple question, but I don't see it anywhere 开发者_如何学Goelse on SO:
Do indexes (indices?) on a temporary table get automatically deleted with the temporary table?
I'd imagine they do but I don't really know how to check to make sure.
Thanks,
Phil
Yes they get dropped along with the table. It is not possible for an index to exist independently of its table.
In terms of checking this for yourself you could do
SELECT OBJECT_NAME(OBJECT_ID), * FROM tempdb.sys.indexes
before and after running your DROP temp table.
精彩评论