Odd Behavior of update query

  • I executed this query:

    update table2

    set id=(select max(id) from table1)

    where id=0.

    It indicates it executed,but on checking no update happened.Out of curiosity what could be the cause of this?I repeated the process successfully.

    “When I hear somebody sigh, ‘Life is hard,’ I am always tempted to ask, ‘Compared to what?’” - Sydney Harris

  • The only thing that pops to the top of my head is that it was in a transaction that rolled back.

  • kapfundestanley (5/31/2012)


    I executed this query:

    update table2

    set id=(select max(id) from table1)

    where id=0.

    It indicates it executed,but on checking no update happened.Out of curiosity what could be the cause of this?I repeated the process successfully.

    how many records do you have in table2 where id=0 ?

    SELECT * FROM table2 WHERE id = 0

    Can you execute SELECT MAX(id) FROM Table1 ?

    What does it return?

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

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

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