We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

SQL Formula in-DB An expression of non-boolean type

AW25
7 - Meteor

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).

2 REPLIES 2
Claje
14 - Magnetar

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.

AW25
7 - Meteor

Thank you Claje! The brackets around the field names solved the problem

Labels
Top Solution Authors