That is a good point Phil.  It is better practice to use
INFORMATION_SCHEMA.TABLES as there is no guarantee that the sysobjects table
code will always work....

________________________________________
From: Philip Arnold [mailto:[EMAIL PROTECTED]
Sent: 08 June 2004 13:54
To: CF-Talk
Subject: RE: checking if a table exists?

> From: Mark Drew
>
> Depending on the database but in MSSQL is:
> if exists (select * from dbo.sysobjects where id =
> object_id(N'[dbo].[que_log]') and OBJECTPROPERTY(id, N'IsUserTable') =
> 1)
> drop table [dbo].[que_log]
> GO

Why not use INFORMATION_SCHEMA.TABLES rather than sysobjects

If exists (select * from INFORMATION_SCHEMA.TABLES where table_name =
'YourTable')

Much more readable
________________________________________
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to