Error near the keyword 'Set' when trying to submite a while for data generate propose - sql-server-2008

I get this error but i don't have any idea how to solve this issue, i'm trying to run this script on Dbeaver it's a simply query but i try to look at all sources i could and dont get any answer, even on the dbeaver foruns.
The script is pretty basic, and the table has only 2 fields Id and Description it's just for pagination test...

I find the answer just by switching the "Id" for "Counter", maybe DBeaver treats the word "Id" in some different mode than others managers.

Related

Query Mysql to find is a statement is valid (NOEXEC perhaps)

Is there any way in mysql to determine of a sql statement is valid before executing it? (In other word rather than execute the stamens and deal with errors I simply want to know if it is a valid statement)
I notice in Mysql workbench that then I type a query it checks it for validity, so I assume there is a way to do that?
In essence I am trying to "precheck" the sql at runtime to see if it is even valid with actually executing it.
Perhaps using the NOEXEC statement?
You can use something called 'SQL Fiddle', you have to build a schema first and then start running your sql queries, see link below:
http://sqlfiddle.com/

mysql query will only return results if i hard code the text in the database

I have a MYSQL database with a query. The query only works if I manually type in the data with MYSQL Admin or with the following statement $sn="x-xxx"; It will not return results if i pass $sn to the database from a form even though the $sn get inserted into the database just fine. I can look at the database and see that it's there. Not sure if why the query would only pull down the records I manually imputed.
Thanks for the help guys. I found that by passing the variable from page to page that a space was being added to the variable. I used:
$sn=preg_replace('/\s+/', '', $sn); and var_dump($sn); to strip the space and to check what was being posed. Wow 5 full days trying to find this. Thanks to everybody who answered.

How to get syntax error's specific description in mysql

My specific problem is solved before completing the question. But I still have a general question. It might be a duplicate but I am sorry I have been unable to find it on SO or elsewhere.
I have a table named reports. There is one row containing data. When I was trying to execute an update query I get an error:
error 1064: There is an error in your sql syntax near 'table='defect',Filter='' ,dtFilter='',query='Select allfields from defect' ,`da' at line 1
My question: is there a way to get my specific error? As it was just telling that there is error in SQL syntax but nothing about what type of error is.
Do I always have to google for such errors or there exists some technique to get their exact specific description locally?
Background (optional reading): after normal googling I got hint while posting question for better googling and get solved my specific problem as I came to know that it was problem of reserve words table and datetime. The problem solved when I put quotes around those words. This usually happens with me. But my general problem is still there...
It my be of no use now but I am sharing my schema here on sqlfiddle it might be useful
MySQL can't tell you that you are using a reserved word in wrong place (or your place is correct but used word is a reserve word, it cant differentiate) , it only only sees what you enter, it can't read the mind, so it can't know that you accidentally used (say) order as a field name, it'll just see a valid part of a query in the wrong place.e.g... a syntax error. It also won't report on ALL syntax errors in a query, because one syntax error renders the whole thing wrong. it can't skip over a word and keep parsing.
Nope - it just tells you the position, which hopefully is a decent clue.

DatabaseLookup hangs on specific values

I use Kettle for some transformations and ran into a problem:
For one specific row, my DatabaseLookup step hangs. It just doesn't give a result. Trying to stop the transformation results in a never ending "Halting" for the lookup step.
The value given is nothing complicated at all, neither it is different from all other rows/values. It just won't continue.
Doing the same query in the database directly or in a different database tool (e.g. SQuirreL), it works.
I use Kettle/Spoon 4.1, the database is MySQL 5.5.10. It happens with Connector/J 5.1.14 and the one bundled with spoon.
The step initializes flawlessly (it even works for other rows) and I have no idea why it fails. No error message in the Spoon logs, nothing on the console/shell.
weird. Whats the table type? is it myisam? Does your transform also perform updates to the same table? maybe you are locking the table inadvertantly at the same time somehow?
Or maybe it's a mysql 5.5 thing.. But ive used this step extensively with mysql 5.0 and pdi 4.everything and it's always been fine... maybe post the transform?
I just found the culprit:
The lookup takes as a result the id field and gave it a new name, PERSON_ID. This FAILS in some cases! The resulting lookup/prepared statement was something like
select id as PERSON_ID FROM table WHERE ...
SOLUTION:
Don't use underscore in the "New name" for the field! With a new name of PERSONID everything works flawlessly for ALL rows!
Stupid error ...

Access query not working?

I remember using a query like this which worked for me before. But now its giving me a compile error.
I am trying to get only the first 3 characters of the second field.
select field1, left(field2, 3) from table1;
What am I doing wrong?
See this link:
http://www.techonthenet.com/access/questions/compile_error.php
It says you can get a compile error when using Left() if you have a broken reference. It also says how to fix it.
There is nothing wrong with your SQL statement. Brackets around field name, semicolon at end of statement, fewer than 3 characters in field2 --- those are all non-issues here.
There is something wrong with your database or your machine and/or its Access installation. Ordinarily I would suspect a references problem because your error is a classic symptom. However, in a comment, you indicated references are OK.
Create a new empty database and import table1 into it. Try your query in the new database. If it works there, you know the problem is limited to the original database. If the query does not work in the new database, copy the database to another machine which has Access installed and try it there. If it works on another machine, but not yours, ... I hope there is some way to repair your original machine without re-installing Office.
What happens in Access if you hit Ctrl-G on the keyboard and in the immediate window type "?Left("123Text", 3)" and hit ENTER? If you get the same compile error, then you have either a missing reference, or a compile error in your database.
To troubleshoot this, while in the VBE window, go to the DEBUG menu and select the first choice, COMPILE [project name]. You will likely receive notification of a compile error, and it should direct you to the problem that you need to fix.
Try putting the field name in square brackets
select field1, Left([field2], 3) from table1;
I don't see anything wrong with your SQL as long as your table names and column names are correct. Depending on your SQL editor or code, you may need to remove the semi colon from the statement.