删除表时是否删除临时表上的索引? [英] Are indexes on temporary tables deleted when the table is deleted?

查看:253
本文介绍了删除表时是否删除临时表上的索引?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下SQL是否也会删除索引 - 或者是否必须单独删除?

Would the following SQL remove also the index - or does it have to be removed separately?

CREATE TABLE #Tbl (field int)

CREATE NONCLUSTERED INDEX idx ON #Tbl (field)

DROP TABLE #Tbl


推荐答案

是的。你可以在MSSQL帮助中搜索CREATE INDEX文章,据说:

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


可以在临时的
表上创建索引当表被删除或
会话结束时,所有索引和
触发器都被删除。

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

这篇关于删除表时是否删除临时表上的索引?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆