phineas629 (1/24/2014)
... I am required to use the cursor...
Perfectly reasonable so long as this is homework. If not, then do it properly:
UPDATE Outlet.tblProductMaster SET
Product_Status = CASE
WHEN Seller_No = @strSellerNo1 AND Product_Status = 'Available' THEN 'Removal'
WHEN Seller_No = @strSellerNo2 AND Product_Status IS NULL THEN 'Available'
ELSE 'UNKNOWN' END
WHERE Product_No = @strProductNo
AND Seller_No IN (@strSellerNo1,@strSellerNo2)
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden