SQL Question 
Author Message
 SQL Question

Does referencing a column in the right-hand side of the = in an
UPDATE....SET statement always refer to the value before the update?

Does it depend on the implementation?  Is this addressed in the ANSI SQL
Standard?

Here's what I mean......

UPDATE some_table
SET    first_value = first_value - (something - something_else)
           second_value = first_value - (something - something_else)
WHERE whatever.........

My intent is to end up with second_value being equal to first_value.  I
tested on Informix 7.31 and Oracle (I didn't pay attention to the
version) and it worked as I expected on both.



Sat, 05 Jun 2004 12:50:34 GMT
 SQL Question

Yes, this is standard. The right hand side is completely computed before
the assignment happens.

Cheers
Serge
--
Serge Rielau
DB2 UDB SQL Compiler Development
IBM Software Lab, Canada



Sat, 05 Jun 2004 23:58:07 GMT
 
 [ 2 post ] 

 Relevant Pages 

1. Access question -> SQL question

2. Update question and SQL question

3. Simple SQL Question for the SQL Gurus

4. SQL question (not really sql server programming)

5. SQL Gurus: Time SQL question

6. SQL Server T-SQL Question

7. SQL Question: Best way to pass array data to SQL Server

8. SQL question for SQL Gurus

9. more dynamic SQL-Server SQL question

10. ms-sql sql question, isnull function

11. SQL Q: Everybody loves a good SQL question


 
Powered by phpBB® Forum Software