Ask Your Question

run queries in macro in mariadb connected odb file

asked 2018-03-13 11:42:46 +0100

RobVld gravatar image

I connected an odb file to mariadb server via ODBC. Works great. now I need to run some action queries via macro. When I create a query in designview the following SQL is created:

SELECT ID, img_blob FROM table.lnk_img AS lnk_img

Query works fine, but when I want to run the SELECT statement in Tools > SQL... Base will crash with unexpected error... probable something wrong with syntax I guess. I also tried this format SELECT "ID", "img_blob" FROM "table"." lnk_img" AS "lnk_img" which causes a crash.

how to format SQL statements in a query?

edit retag flag offensive close merge delete


I createrd a new odb file connected with JDBC, using the mysql connecting... the query is now created like this: SELECT ID, img_blob FROM table.lnk_img AS lnk_img

This also works in Tools > SQL...

In my macro I have to add " to the SQL statement like this: SELECT "ID", "img_blob" FROM "table"."lnk_img" AS "lnk_img"

Am I correct?

RobVld gravatar imageRobVld ( 2018-03-13 12:30:16 +0100 )edit

1 Answer

Sort by » oldest newest most voted

answered 2018-03-13 13:55:24 +0100

Ratslinger gravatar image

Hello @RobVld,

When using MariaDB or MySQL the fields or table names are surrounded by the back tick and not the quote mark.

SELECT `ID`, `img_blob` FROM `table`.`lnk_img` AS `lnk_img`

This is true in macros also.

edit flag offensive delete link more



Only reserved keywords need to be in backticks. Full explanation at

Jim K gravatar imageJim K ( 2018-03-13 15:32:57 +0100 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-03-13 11:42:46 +0100

Seen: 19 times

Last updated: Mar 13