How do I find out if a table already exists?

How do I find out if a table already exists?

Post by James Schmid » Sat, 15 Sep 2001 23:25:32



I'm using ADO 2.5, an Access database file, and of course VB 6.0 sp5.
I need to know how to find out if a table exists in the database. I'm
looking for some method that will return like a boolean value as to whether
the table exists or not - that would be perfect anyway.
Any help as soon as possible is much appreciated.

Thank you
James Schmidt

 
 
 

How do I find out if a table already exists?

Post by ruste » Sun, 16 Sep 2001 01:55:05


James,

you will need to use catalog object -

dim cat as adox.catalog

cat.activeconnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\xxx.mdb"

dim tabs as table

for tabs in cat.tables
     if tabs.name = "table name to search for" then
       msgbox "table found"
     else
       msgbox "table NOT found"
     end if
next

HTH

rusteya


> I'm using ADO 2.5, an Access database file, and of course VB 6.0 sp5.
> I need to know how to find out if a table exists in the database. I'm
> looking for some method that will return like a boolean value as to whether
> the table exists or not - that would be perfect anyway.
> Any help as soon as possible is much appreciated.

> Thank you
> James Schmidt


 
 
 

1. How to find out if a table already exists with PL/SQL

Hi,

I'm porting a Sybase script to Oracle. There is this thing that we do in
Sybase but I just can't do in Oracle. In Sybase, we do:

if exists (select * from sysobjects where name = 'TEMPTBL')
 begin
 print "Deleting table TEMPTBL....."
 drop table TEMPTBL
 end
go

Just how do I do this in Oracle?

TIA

2. cursor keys with print preview window

3. How to check if a table already exists

4. OEM server

5. vb: check if table already exists??

6. Confusion with WHERE EXISTS.

7. check if table already exists??

8. Strange stuff with WHILE, WAITFOR and @@GLOBALS

9. How to check if an tempory table already exists

10. Temporary Table already exists

11. table already exists ???

12. an already existing alter table drop column ?!?!?!

13. add new table unless already exists