SYSIDX system view has a property called Syntax error near 'property_name_here' on line 1 UPDATE Query that causes error: $query = sasql_query($conn, "SELECT st.table_name, stc.column_name, si.index_category, si.unique FROM sysidxcol sic INNER JOIN systab st ON st.table_id = sic.table_id INNER JOIN systabcol stc ON stc.column_id = sic.column_id INNER JOIN sysidx si ON si.index_id = sic.index_id WHERE st.table_id = stc.table_id AND si.table_id = sic.table_id AND st.table_id BETWEEN 691 AND 747" ); Also tried this: $query = sasql_query($conn, "SELECT st.table_name, stc.column_name, si.index_category, si.['unique'] FROM sysidxcol sic INNER JOIN systab st ON st.table_id = sic.table_id INNER JOIN systabcol stc ON stc.column_id = sic.column_id INNER JOIN sysidx si ON si.index_id = sic.index_id WHERE st.table_id = stc.table_id AND si.table_id = sic.table_id AND st.table_id BETWEEN 691 AND 747" ); But it gives the next error sasql_query(): SQLAnywhere: [-143] Column ''unique'' not found asked 04 Jul '18, 11:05 ilyas_khametov |
Found a solution myself. Thanks for Mark Culp for speicfying direction to search my problem. In order to select columns, which names are similar to a reserved SQL word, put square brackets around column name: SELECT [column_name] FROM table_name answered 04 Jul '18, 11:37 ilyas_khametov 1
Glad you found your solution. Note that you tried to use single quotes (') around the word and this resulted in your error. In SQL single quotes are used to construct a string. To construct an identified you need to use double quotes (") or, as you have discovered, use brackets []. You can read more about SQL identifiers here: http://dcx.sap.com/index.html#sqla170/en/html/8170eb5b6ce21014a7e1a2fd6b4a85fc.html and read about SQL strings here: http://dcx.sap.com/index.html#sqla170/en/html/817b3d006ce21014ad07f050c018135e.html
(04 Jul '18, 11:51)
Mark Culp
|
Please show us the exact queries that you are using.
Note that the SYSIDX table has a column called unique but the word 'unique' is a keyword so it must be quoted (using double quotes) when used as an identifier. The table in the SYSIDX docs page is simply adding the double quotes around unique to indicate this fact.
Updated my question with queries from the code