...

View Full Version : DROP Table errors



ecnarongi
12-17-2003, 05:48 PM
is there a problem with this statement if I using an Access Database? I've used a mysql database and it seems to work fine.

SQLdrop = "DROP TABLE IF EXISTS storenames"
connList.execute(SQLdrop)

storenames is the table in the database and assume that the connection string is correct.

I get this error:


Microsoft JET Database Engine error '80040e14'

Syntax error in DROP TABLE or DROP INDEX


all help is appreciated. thanks

raf
12-17-2003, 07:41 PM
I don't think JetSQL know the 'if exists' addition. Try it with just
DROP TABLE tablename

A1ien51
12-17-2003, 07:44 PM
you might want to try to play with this....not sure if it will work, but what the hey...


IF EXISTS( SELECT name
FROM database
WHERE name = table_name)
DROP TABLE table_name


Eric

ecnarongi
12-17-2003, 10:24 PM
Thanks, I thought that access couldn't handle "if exists" and I guess I was right. I will try that routine, thanks for replying.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum