• ChrisM@Work (1/30/2014)


    It's by design, Kapil. There are two steps to the update/insert - a read to determine the rows which will be affected (by the join to source) and then the update/insert. The read remains unchanged throughout as a static reference - in other words, a snapshot. The purpose of this is to ensure that changes occur in a predictable manner. It's called Halloween Protection and Craig Freedman describes it far better than I can here.

    It's up to you to shape your source data appropriately.

    Is there any alternate way to achieve this other than using IF EXISTS...

    _______________________________________________________________
    To get quick answer follow this link:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/