删除临时表(如果存在) [英] Delete a temporary table if it exists

查看:225
本文介绍了删除临时表(如果存在)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

需要删除一个临时循环的表格。



需要检查表格是否存在。





你如何编码?



例如



IF EXISTS #VLOANS

BEGIN

DROP TABLE #VLOANS

END




试过这个



请帮助



我是什么尝试过:



检查了我的sql服务器代码并访问了互联网但无济于事

Need to delete a table which is temporary in a loop.

Need to check if the table exists.


How do you code ?

For example

IF EXISTS #VLOANS
BEGIN
DROP TABLE #VLOANS
END


Tried this

please assist

What I have tried:

Checked my sql server codes and visited the internet but to no avail

推荐答案

这样的东西应该工作

Something like this should work
IF OBJECT_ID('tempdb..#VLOANS') IS NOT NULL DROP TABLE #VLOANS



当我使用搜索时,我得到了大约128,000个例子


I got about 128k examples when I used the search

Quote:

sql server删除临时表(如果存在)

sql server delete temporary table if exists


这篇关于删除临时表(如果存在)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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