I want to view all columns in a DB2 database query however I want to put a certain column at the front.
For example from my sql knowledge I would write something like
SELECT Field2, * FROM Table
SQL State: 42601
Vendor Code: -104
Message: [SQL0104] Token * was not valid. Valid tokens: ( + - ? : DAY INF NAN RID ROW RRN CASE CAST CHAR DATE DAYS HASH. Cause . . . . . : A syntax error was detected at token *.
Token * is not a valid token. A partial list of valid tokens is ( + - ? : DAY INF NAN RID ROW RRN CASE CAST CHAR DATE DAYS HASH.
This list assumes that the statement is correct up to the token.
The error may be earlier in the statement, but the syntax of the statement appears to be valid up to this point. Recovery . . . :
Do one or more of the following and try the request again: -- Verify the SQL statement in the area of the token *.
Correct the statement. The error could be a missing comma or quotation mark, it could be a misspelled word, or it could be related to the order of clauses.
-- If the error token is <END-OF-STATEMENT>, correct the SQL statement because it does not end with a valid clause.
Processing ended because the highlighted statement did not complete successfully
You can do this using a correlation name, like so:
SELECT Field1, tbl.* FROM YourTable tbl
tbl.* returns all columns, so
Field1 will appear twice in the result.