Kedarnath M S
Kedarnath M S

Reputation: 79

SQL Server : an expression of non-boolean type specified in a context where a condition is expected, near 'AND'

Getting this error with the following query in SQL Server 2012.

AND Invoice_Header.Invoice_date >= '2005-02-28'  
AND(LTRIM(RTRIM(@carrierselect)))
--Error on this line of code
AND CATEGORY IN ('MEDP', 'MEDG')
AND invoice_status_code <> 'L' 

Upvotes: 1

Views: 5284

Answers (1)

Felix Pamittan
Felix Pamittan

Reputation: 31879

Your error is here:

AND(LTRIM(RTRIM(@carrierselect)))

You do not have any comparison that will result to a boolean value. You must have forgotten to put something there:

AND(LTRIM(RTRIM(@carrierselect))) = 'something'

Upvotes: 1

Related Questions