• This is an example of a replacement for all the code posted to use the cursor.

    UPDATE t SET

    Product_Status = 'Available'

    FROM Outlet.tblProductMaster t

    WHERE Product_Status IS NULL

    AND NOT EXISTS( SELECT *

    FROM Outlet.tblProductMaster x

    WHERE x.Product_No = t.Product_No

    AND x.Seller_No <> t.Seller_No

    AND x.Product_Status = 'Available' )

    Less than a third of code lines (and I'm not counting blank lines) and should perform a lot faster.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2