Hi,
I am working on MSSQL 2005
I want in table TMPMATERIALORDERED field Quantity should be numeric and greater than 0, if not than the
STATUS should be set to FAILURE and REMARKS should be set to Quantity is not numeric or Quantity is less than 0
In table TMPMATERIALORDERED my filed Quantity is nvarchar(100)
My query gives error says
Msg 4145, Level 15, State 1, Line 3
An expression of non-boolean type specified in a context where a condition is expected, near 'Then'.
Please find my query below and help me in correcting it
Update TMPMATERIALORDERED
Set STATUS = Case
When Not IsNumeric(Quantity) Then 'FAILURE'
When IsNumeric(Quantity) And Quantity <=0 Then 'FAILURE'
Else NULL
End,
Set REMARKS = Case
When Not IsNumeric(Quantity) Then 'Quantity is not numeric'
When IsNumeric(Quantity) And Quantity <=0 Then 'Quantity is less than 0'
Else NULL
End
WHERE
QUANTITY IS NULL
AND STATUS IS NULL
Please Help
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Most Valuable Expert award recognizes technology experts who passionately share their knowledge with the community, demonstrate the core values of this platform, and go the extra mile in all aspects of their contributions. This award is based off of nominations by EE users and experts. Multiple MVEs may be awarded each year.
The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.