Fairly simple question, but I don't see it anywhere else 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With