可能重复:
TSQL: Are indexes on temporary tables deleted when the table is deleted?删除全局临时表中的索引在SQL Server
你如何手动删除全局临时表的索引在SQL Server?
编辑:你甚至需要如果你手动删除表?
可能重复:
TSQL: Are indexes on temporary tables deleted when the table is deleted?删除全局临时表中的索引在SQL Server
你如何手动删除全局临时表的索引在SQL Server?
编辑:你甚至需要如果你手动删除表?
如果您要删除临时表本身,则不需要在临时表上删除索引。它会在你放下桌子时自动发生。
Are indexes on temporary tables deleted when the table is deleted?
这对我来说是创建并删除索引。
CREATE TABLE ##TempTable (Col1 int)
CREATE INDEX IDX on ##TempTable
(Col1)
DROP INDEX IDX ON ##TempTable
全局临时表将其索引被破坏时,所有会话引用该表将结束,或者当您需要手动删除该表,但是,你仍然可以通过手,如果你需要删除索引至。
的语法是
drop index ##MyTempTable.MyIndex
或:
drop index MyIndex on ##MyTempTable