Ask Your Question
0

run queries in macro in mariadb connected odb file

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

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

Comments

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 +0200 )edit

1 Answer

Sort by » oldest newest most voted
1

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

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

Comments

1

Only reserved keywords need to be in backticks. Full explanation at https://stackoverflow.com/questions/1....

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

Question Tools

1 follower

Stats

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

Seen: 27 times

Last updated: Mar 13