Guys,

I have a select statement ere one of the field has a negative value.
How do i convert it into zero in select statement.

;with CTE as
(
Select
Itemid
,AVAILORDERED as OnHandQty - just want to convert some negative result into 0
From MyTable
)
Select * from CTE

Thank you in advance..

jov

CASE (ISNULL([QtyOnHand],0)) WHEN < 0 THEN 0 ELSE ISNULL([QtyOnHand],0) END

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.