drop table (if it exists) using ADO 
Author Message
 drop table (if it exists) using ADO
Hello,

Can someone tell me how I can use ADO (Not SQL) to drop a table, only if it
exists.  Actually I can use sql to do the actual "drop table mytable", but
is there a way in ADO to do this.

if (mytable exists)  ' <----- some ado specific code here ??
    ...
    .execute "drop table mytable"
end if

The reason I can't use sql and a (if .. exists) statement is because i'm
still using Access2k, not sql server, and as far as I know, it chokes when I
throw that in.

Thanks!



Mon, 28 Jun 2004 05:29:07 GMT
 drop table (if it exists) using ADO

Hi Michael,

Check ADOX library. It allows to manipulate structure of
database.

Val

Quote:
>-----Original Message-----
>Hello,

>Can someone tell me how I can use ADO (Not SQL) to drop a
table, only if it
>exists.  Actually I can use sql to do the actual "drop
table mytable", but
>is there a way in ADO to do this.

>if (mytable exists)  ' <----- some ado specific code
here ??
>    ...
>    .execute "drop table mytable"
>end if

>The reason I can't use sql and a (if .. exists) statement
is because i'm
>still using Access2k, not sql server, and as far as I

know, it chokes when I

- Show quoted text -

Quote:
>throw that in.

>Thanks!

>.



Mon, 28 Jun 2004 20:41:51 GMT
 drop table (if it exists) using ADO
Hello,

If it's an Access database, Jet SQL doesn't provide the statement like that
in SQL Server's T-sql. Thus, I think it's better for you to use DAO instead
of ADO if you need to manipulate the Access database objects.

To check if a table exists in an Access database, we can use DAO and go
through the TableDefs collection to check if the table exists in the
collection.

Hope it helps!

Allan
This posting is provided "AS IS" with no warranties, and confers no rights.



Tue, 29 Jun 2004 10:36:12 GMT
 
 [ 3 post ] 

 Relevant Pages 

1. IF TABLE EXISTS DROP TABLE

2. create and drop tables using vc++ADO

3. How to check if primary key constraint exist and drop it if it exist

4. Drop Table If Exists

5. dropping a table, if it exists?

6. IF EXISTS and DROP TABLE

7. drop table if exists

8. code to drop temp table that optionally exists

9. Dropping a Table (If it exists)

10. easiest way to drop a table if it exists in DBA_TABLES

11. Beginner's question : IF EXISTS(...) DROP TABLE

12. if exists and dropping tables


 
Powered by phpBB® Forum Software