[thelist] ColdFusion & MSAccess - How do I check if a table exists?

Joshua Olson joshua at alphashop.net
Sat Apr 21 13:20:10 CDT 2001


Jon,

You do not need to skip the query, really.  You can try to create the table
again and then trap the database error via <cftry> and <cfcatch>.  This
technique is nice because it'll work with any database that is capable of
throwing an error under such circumstances.

The other technique (like you are requesting) is to query the system tables
for the object.  So, you are adding another select query to the mix at
minimum.  So, the create+catch method may be quicker in the long run.

-joshua

> -----Original Message-----
> From: thelist-admin at lists.evolt.org
> Subject: [thelist] ColdFusion & MSAccess - How do I check if a table
> exists?
>
>
> Hello everyone,
>
> I'm using ColdFusion and Microsoft Access. Somewhere
> in my app I create a table using <cfquery>. Now I want
> to add a <cfif> to skip this <cfquery> if the table
> exists. How is this done? I tried the 'show' statment
> (like in MySQL) but it didn't work. I'm guessing I
> need to get all tables in the database in an array
> (using some sql statement), and then check to see if
> one exists with the same name as the one I am
> creating.
>
> Your help's greatly appreciated.
>
> Jon.





More information about the thelist mailing list