• I don't have the rules for the 'Replacement' option, but here's the code that should work for the query as you have it now.

    UPDATE t SET

    Product_Status = CASE WHEN EXISTS( SELECT *

    FROM #tblProductMaster x

    WHERE x.Product_No = t.Product_No

    AND x.Seller_No <> t.Seller_No

    AND x.Product_Status = 'Available' ) THEN 'Not Available'

    ELSE 'Available' END

    FROM #tblProductMaster t

    WHERE Product_Status IS NULL

    Be sure to test it before using it in production. My tests were limited to sample data that I created and might not reflect the actual data in your database.

    By the way, I hope you can start migrating DTS packages to DTSX packages (aka SSIS packages). You'll have more functionality and won't have major problems if you plan on migrating to future versions of SQL Server (DTS packages won't work on Sql Server 2012).

    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