Update statement.

  • I am trying to perform an update statement and when I invoke it, it runs continually until I dump it. The statement is

    UPDATE TABLE1

    SET COLUMN1 = POWER(10,B.COLUMN1)

    FROM TABLE1 A, TABLE2 B

    WHERE A.COLUMN2 = B.COLUMN2

    AND A.COLUMN3 = B.COLUMN3

    AND A.COLUMN4 = B.COLUMN4

    The majority of the data in B.COLUMN1 is null

    I am watching the transaction log and it is not moving. I am also watching the Tempdb and locks and there is no information there.

    Can anyone help or give me some suggestions on what to do next

  • Try this syntax:

    
    
    UPDATE a
    SET COLUMN1 = POWER(10 , ISNULL(b.COLUMN1, 0))
    FROM TABLE1 a
    INNER JOIN TABLE2 b
    ON a.COLUMN2 = b.COLUMN2
    AND a.COLUMN3 = b.COLUMN3
    AND a.COLUMN4 = b.COLUMN4

    Also, you do realize that this is updating 10 to the power of the value of ColumnB, right, and not the other way around...

    Just want to make sure you knew the order of the parameters...sometimes I forget, myself 🙂

Viewing 2 posts - 1 through 1 (of 1 total)

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