Search code examples
mysqlsqlaqua-data-studio

How to run multiple queries in row safely?


I have the below queries and i can run them one by one successfully,

Delete from eventor.user_role ;
Delete FROM eventor.role ;
delete from eventor.user ;

but when i run all of them together, it complains with the error:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Delete FROM eventor.role ;

This is a surprise for me since, i can run the

 Delete FROM eventor.role ;

successfully, and i have terminated all the queries using ;.

So, why am i getting this, and how can i fix it?


Solution

  • According to http://www.aquafold.com/support_faq#commands:

    Q: Scripts with multiple statements return errors, while each statement can be executed individually without errors.

    Example:

    select * from t1 select * from t2 select * from t3

    This script returns errors.

    Aqua Data Studio uses “go” or “/” symbols as line separators between statements.
    Here is a corrected example of the same script:

    select * from t1
    /
    select * from t2
    /
    select * from t3
    

    or

    select * from t1
    go
    select * from t2
    go
    select * from t3
    go
    

    Try using go or / instead of ;