469,603 Members | 2,049 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,603 developers. It's quick & easy.

how to drop a temporary table

hai,

I want to drop a temporary table if it exists. How can we do this.


thanks in advance.
Mar 5 '08 #1
2 1206
amitpatel66
2,367 Expert 2GB
hai,

I want to drop a temporary table if it exists. How can we do this.


thanks in advance.
please post what you have tried so far?
Mar 5 '08 #2
nedu
65
Hi,

You shall use the below code . .

if exists (select * from dbo.sysobjects where id = object_id(N'tempdb..#temp1') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
Begin
drop table [#temp1]
print 'dropped'
End
Else
Begin
print 'No Such tables'
End

Regards,
Nedu. M
Mar 5 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Rod Davis | last post: by
5 posts views Thread by Jay | last post: by
2 posts views Thread by robert | last post: by
reply views Thread by guiromero | last post: by
reply views Thread by devrayhaan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.