SQL update using values ​​from one record

The following expression f1will always get the value that has f2? Or will it be updated first f2, but f1ends with NULL? I get the impression that the new values ​​are not available in the statement, which f2has the old meaning when processing the record, but I can’t find an authoritative place that speaks about this.

UPDATE x
SET
    x.f1 = x.f2,
    x.f2 = NULL
+5
source share
2 answers

Conceptually, the operation occurs "all at once" , so that it uses the values ​​"before"

Really,

UPDATE x
SET
 x.f1 = x.f2,
 x.f2 = x.f1

also works great for replacing two column values.

+3
source

f1 f2 UPDATE.

. , SQL , , .

SQL Triggers :

DELETE UPDATE. DELETE UPDATE . .

INSERT UPDATE. , . - .

http://msdn.microsoft.com/en-us/library/ms191300.aspx

+2

All Articles