Thanks gang, I inadvertently stumbled on the one below while looking in the
SQL books online under INSERT (something completely different). Works like a
charm. Thanks Jeff.


This is the code I used.
<cfquery ...>
IF EXISTS(SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME
= 'T1')
    DROP TABLE T1
</cfquery>

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Friday, December 15, 2000 8:38 PM
> To: CF-Talk
> Subject: Re: SQL DROP TABLE
>
>
> Gary,
>
> select name
> from sysobjects
> where name = 'tablename'
>
> That should tell you if the table exists.
>
> Jeff Craig
> ICQ 51303123
>
> ----- Original Message -----
> From: "Gary McNeel, Jr." <[EMAIL PROTECTED]>
> To: "CF-Talk" <[EMAIL PROTECTED]>
> Sent: Friday, December 15, 2000 6:36 PM
> Subject: SQL DROP TABLE
>
>
> > I am trying to use cfquery to drop a table. That works fine.\
> >
> > Problem:
> > If I run the DROP TABLE on a database where the table is already gone I
> get
> > a nasty SQL error. Is there a simple way to check for the
> existance of the
> > table, and if present, then drop it? My mind is mush right now and I
> cannot
> > figure this one out. Thank all.
> >
> > Regards,
> >
> > Gary McNeel, Jr.
> > DACNet Project Manager
> > Research and Graduate Studies
> > Rice University
> > [OP] 713-348-6266
> > [M] 713-962-0885
> > [HO] 713-723-9240
> >
> >
> >
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to