I want to get time difference between two dates saved in MySql DB inside Grails criteria. For this purpose I have added below code in domain's mapping section.
formula: "(SELECT TIMESTAMPDIFF(SECOND, start_record, end_record))"
But SECOND is being treated as field and throwing sql syntax error.
There must be some trick to fix it, expecting it from SO community. Thanks
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 'this_.SECOND, this_.start_record, this_.end_record))) as y6_ from answer_meta_da' at line 1.
Grails Version: 3.3.9 | JVM Version: 1.8.0_121
Related
I tried to resize in many different ways but I always get the same error:
ERROR 1064 (42000): 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 'innodb_temp_data_file_path=ibtmp1:12M:autoextend:max:500M' at line 1
As mysql manual on sysvar_innodb_temp_data_file_path says, it is not a dynamic variable, therefore cannot be set using set sysvar_innodb_temp_data_file_path=... method via sql. You need to include it either in your mysql config file or as a startup parameter to the mysql service.
I've programmed a project in symfony and mysql 5.6. then I uploaded my project to a remote server on 1&1. the remote server has mysql 5.7 version. All doctrine queries run ok and without problem. But when a user searches something, a request will be sent to the server and a doctrine query will be executed. Here it returns the following error:
SQLSTATE[42000]: Syntax error or access violation: 1064 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 'integer)
BETWEEN 1940 AND 2002) AND u0_.id <> 2' at line 1
I think, it is probably because of different versions of mysql. Because on localhost it runs without problem
Can you please help me how to solve it? is there a way to regenerate all the migrations according the new mysql version? or may be there is another solution?
thanks
I was using CAST('number' as integer) in mysql 5.6. It did ok. However in mysql 5.7 and I do not know why, it does not run ok. So I changed it to CAST('number' as UNSIGNED) and it works ok
when trying to run Insert/Update or LookUp functions in Pentaho to get my SQL tables it shows me this error, anyone knows, how can I fix it?
Error getting views from schema [null]
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 'HAVING TABLE_TYPE IN ('VIEW',null,null,null,null) ORDER BY TABLE_TYPE, TABLE_SCH' at line 1
Downgrade your Mysql version compatible to Pentaho version. You should get that in your Pentaho manual.
I downgraded from mysql 8.0 to 5.6/5.5 and on 5.6 its got resolved.
I have to support an application on a MySQL server. I can´t change the source code so I can´t change the used syntax.
My problem is that I always get an syntax error like this:
Microsoft OLE DB Provider for ODBC Drivers [-2147217900]
[MySQL][ODBC 5.1 Driver][mysqld-5.6.26]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 'Partition as Signed)' at
line 1
I looked into the log file and found the problem in this line:
Select *
from XYZ
where `Type`='something'
and Client='{3DBEA33A-9F0A-4e86-8354-F652713EA458}'
order by Cast(Partition as Signed);
I always get this error when the "Cast(Partition as Signed)" appears.
Is there any way to configure the server to accept this syntax?
I´m using MySQL (x64) 5.6.26 with InnoDB.
Partition is reserved word.
http://dev.mysql.com/doc/refman/5.6/en/keywords.html
you should use it with backticks
`Partition`
MySQL only gives an unhelpful error message when it encounters a grammar or syntax 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 .......
Is there any way to let MySQL to explain syntax error (e.g. expecting closing parenthesis, illegal expression, etc) in details?
The answer is - no. All server errors messages and their codes are listed in the documentation.
Server Error Codes and Messages.
From the documentation - For error checking, use error codes, not error messages. Error messages do not change often, but it is possible.
About the syntax errors: if there are no more specific error codes, then you get Error: 1149 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax...
As a work around: You can view all syntax errors in dbForge Studio for MySQL. Create new SQL document and write some code, or just open SQL-file, automatic SQL syntax check will highlight errors in the code.
Automatic SQL syntax check feature.
This feature is available in Professional and Enterprise editions, but you can try it on trial version.