column values don't get updated

  • I need help please on the following:

    I have a query that updates a column of a table A. When I run the query it returns a message that 3 rows were updated. When I check the values of the rows that should be updated, they still have different values although it says they were updated. Any one encountered the same problem and resolved it?

    update A

    set A.columnC = B.ColumnD

    from table A

    join table B

    ON A.ID = B.ID

    where A.columnC <> B.ColumnD

  • Seems to me several rows in table B match a row in A so the A row would be set three times. Without an ORDER BY there is no way to know which B row value it will be set to.

  • I am looking into that thank you!

  • Trigger on the table?

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply