Forum Discussion
Anonymous
5 years agoNot applicable
ODBC SQL incorrect syntax near '='
Hello, I am trying to run this SQL using ODBC connection in Power Query: SELECT
IIF(column1 = 'C', Left(column2,10), '') AS 'Column3'
FROM table But keep getting the following error:...
Anonymous
5 years agoNot applicable
Well in that case, what's the datatype of Column1?
Anonymous
5 years agoNot applicable
AnonymousThe datatype is text for Column1
- Anonymous5 years agoNot applicable
hi Anonymous
Try this. I believe the problem is not with "=", but the condition expression. Also I hope the datatype of Column2 is also varchar, else it could be problem too.
SELECT
IIF(cast(column1 as varchar(10) = 'C', Left(column2,10), '') AS 'Column3'
FROM tableThanks!