Hello! I'm retrieving/manipulating data from our SQL database through Alteryx and I keep running into this error:
Error: Microsoft OLE DB Provider for SQL Server: An expression of non-Boolean type specified in a context where a condition is expensed, near 'Balance'\42000 = 4145 in Query
Here is a simplified version of the expression that's still prompting the error. What's weird is that when I enter this in Management Studio, I don't get any errors.
SELECT
CASE
WHEN 51010Balance IS < 0
THEN (1)*51010Balance
WHEN 51020Balance IS < 0
THEN (1)*51020Balance
ELSE (0)*51020Balance
END
The Output Field is a new column that I defined as FixedDecimal (I tried Double and V_WString as well).
Solved! Go to Solution.
SQL in Alteryx is largely the same as it is in any other tool, but there are sometimes a few small semantic issues that can trick you up.
Two quick suggestions that may or may not help - I have had success with these in the past, but your error may be related to another problem.
1) Enclose your field names in brackets, eg: [51010Balance] - that way if for some reason it is being interpreted otherwise, you forcibly tell Alteryx to read them as fields.
2) Try removing the keyword IS from your Case statement. I don't know if this will change anything, but I don't believe it is required in SQL.
Thank you Claje! The brackets around the field names solved the problem