How can I check to see if a database table exists, and then if it does exist, drop it.
(ie
IF(TABLE TESTER EXISTS)
DROP TABLE TESTER
I am having a problem with the correct syntax. Could someone please help me with that.
if exists
(select * from dbo.sysobjects
where id = object_id(N'[dbo].[tablename]')
and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[tablename]
GO
Terry L. Broadbent FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.