1

I'm trying to execute a statement like:

UPDATE table1 SET name="Joe" WHERE id='1'; UPDATE table2 SET name="Bob" WHERE id='2'

But, when executing the query, I get:

Microsoft JET Database Engine error '80040e14' Characters found after end of SQL statement.

It works when I execute the statements separately, though.

So I'm guessing there's absolutely no way to execute multiple queries in a single SQL statement when using Microsoft Access/JET database engine?

  • Possible duplicate: http://stackoverflow.com/questions/1838593/how-do-i-execute-multiple-sql-statements-in-access-query-editor – Kamil Jun 11 '13 at 20:45

2 Answers2

5

No, there is no way to do this except through VBA or such like, when the statements can be Executed seperately, but as a single procedure.

Fionnuala
  • 90,370
  • 7
  • 114
  • 152
  • I'm basically trying to do (in ASP) conn.Execute("query1; query2; query3"), but the only possible way I can do this is conn.Execute("query1"), conn.Execute("query2"), conn.Execute("query3")? –  Aug 14 '09 at 21:25
  • Yes, one by one is the only way. – Fionnuala Aug 14 '09 at 21:37
0

probably the easiest way is Create Stored a Procedure and just execute it in your code. with exec command.

Sash the man
  • 25
  • 1
  • 5
  • have u looked into this @Kamil ? http://www.ehow.com/how_7350298_call-using-ms-access-vba.html – Sash the man Jul 03 '13 at 18:07
  • I didn't saw that article, thanks. BTW after you changed whole answer my comment is obsolete ;) Next time delete wrong post and write new one, because you can't edit others comments related with previous version of post. – Kamil Jul 04 '13 at 22:33
  • hey, Thanks a lot, I'm a newbie in Stackoverflow :D will do – Sash the man Jul 08 '13 at 19:58