Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
maya_zakry
Constraint Violating Yak Guru
379 Posts |
Posted - 2007-03-29 : 00:28:11
|
hi guys..i need someone to confirm this :-when we updating columns in the same update statement, the new updated column is not apply yet until the statement end? i mean like if we update columnA from 1 to 2, in the same statement, we update column B = columnA + 2.. the query will update column B to 3, not 4.. isnt it? just found this, and spend sometimes to find why is B updated wrongly ~~~Focus on problem, not solution~~~ |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-03-29 : 01:10:06
|
| [code]-- Prepare sample dataDECLARE @Sample TABLE (a INT, b INT)INSERT @SampleSELECT 1, 9-- Do the testUPDATE @SampleSET a = a + 100, b = 200 * a-- Show the resultSELECT *FROM @Sample[/code]Peter LarssonHelsingborg, Sweden |
 |
|
|
maya_zakry
Constraint Violating Yak Guru
379 Posts |
Posted - 2007-03-29 : 01:46:32
|
| so it's confirmed peter? so this is the way u say yes .. in codes?? :P, i just couldnt believe i just know abt this today :(~~~Focus on problem, not solution~~~ |
 |
|
|
|
|
|