December 23, 2003 at 10:46 am
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[LV_Group]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[LV_Group]
The above syntax checks and deletes a regular table. How do I write one that checks for a local temp table? For example, how do I check for the existence of a local temp table "#tbl_temp" and delete it? Thanks.
December 23, 2003 at 11:11 am
if exists (select * from tempdb.dbo.sysobjects where id = OBJECT_ID('tempdb..#tbl_temp'))
drop table [dbo].[#tbl_temp]
December 23, 2003 at 5:43 pm
or just
Object_ID('TempDb..#Temp') is not NULL
(which I found in a previous posting but I cannot find now to attribute it, sorry)
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy