Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Location
    Northern NJ
    Posts
    404
    Thanks
    0
    Thanked 1 Time in 1 Post

    DROP Table errors

    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
    I would rather be a lion for a day than a lamb that lives forever.

  • #2
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I don't think JetSQL know the 'if exists' addition. Try it with just
    DROP TABLE tablename

  • #3
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    you might want to try to play with this....not sure if it will work, but what the hey...
    Code:
    IF EXISTS(  SELECT name 
    	  FROM 	 database 
    	  WHERE  name = table_name)
    DROP TABLE table_name
    Eric
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Location
    Northern NJ
    Posts
    404
    Thanks
    0
    Thanked 1 Time in 1 Post
    Thanks, I thought that access couldn't handle "if exists" and I guess I was right. I will try that routine, thanks for replying.
    I would rather be a lion for a day than a lamb that lives forever.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •