Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Verifying existance of database table

Status
Not open for further replies.

jalbao

Programmer
Nov 27, 2000
413
US
Does anyone know if there is a statement in SQL that can check for the existance of a table in the database?

I am using Access (for development than I upsize to SQLServer). My app requires that I create tables dynamically. There are certain situations where I need to check if table that I am attempting to get into exists or not. If the table doesn't exist, I want to run a page that let's the user know of the error -

I'm thinking that there must be a statement that allows me to view the names of all the tables in my database - if this is true, I'm home free...

Thanks
 
yes, you could go tromping through the MSysObjects table...

I think what you really want to do is use CFTRY/CFCATCH blocks...

<cftry>
<cfquery datasource=&quot;Yours&quot; name=&quot;whatever&quot;>
Select TOP ID From DoesThisTableExist
</cfquery>

<cfcatch>
..nope.., send your message...
</cfcatch>
</cftry>

Email me at feedback@cfhub.com and I will let you know when the SYS objects tutorial is finished... Cool stuff but I am thinking it will be at least a week or two away.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top