全局临时表删除操作
如何检查SQL Server中是否存在全局临时表,如果存在则删除该全局临时表?
我正在尝试执行此操作:
IF OBJECT_ID('##Table', 'U') IS NOT NULL
DROP TABLE ##Table
...但它不起作用。
How to check if the global Temporary table exists in SQL server, if yes then delete that global temporary table?
I am trying to execute this:
IF OBJECT_ID('##Table', 'U') IS NOT NULL
DROP TABLE ##Table
...but it is not working.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
检查临时表是否存在并将其删除
To check the presence of temp table and delete it
您可以检测临时表的存在,
并且令我惊讶的是,您可以将其从任何连接中删除但是
,我忍不住认为这样做将是一个坏主意,因为大概创建它的连接/用户可能仍然正在使用它...
You can detect temp table presence with
and, surprisingly to me, you can drop it from any connection with
However, I can't help but think that doing so would be a bad idea, since presumably the connection/user who created it might still be using it...
在此视图中查看该表是否存在:
look in this View to see if the table exists: