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 gkittelson 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
 
In Ms. Access there are a number of approaches to this. Probably the easiest and most straightforward would be to just open the table with error trapping in your module. Check the error status for 'not found'.

If you REALLY need to check, you could loop through the tabledfs collection checking for the name. If it is found - the table exists, AND you could check on hte various fields/properties. If not found, it doesn't exist (in the specific database.
MichaelRed
redmsp@erols.com

There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top