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 |
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2002-10-22 : 10:48:03
|
| I've seen references (code snippits) around here to SQL statements of the form...."select cola,c,b,d from table1 where cola = cola = valueb etc"but naturally can't find them because i don't know what the form of these statements they're called....(or the terminology that might be contained in the relevent posts, so that i can include the 'hot' words in a forum search)some of you guru's might be able to jump-start my search please...I'm trying to do an update statement where cola gets updated with valueb and then colc uses the 'new updated' value of cola in a 2nd calculation....ie.....update table1set cola = valueb,colc = cold / colabut at the moment i'm getting colc to come out with a result based on the value of cola before being updated to valueb...can this be done???? |
|
|
Page47
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2002-10-22 : 11:23:17
|
Andrew, are you thinking of the @variable = column = expression syntax of the UPDATE statement? It's pretty well documented in BOL.declare @cola intupdate tabl1set @cola = cola = valueb, colc = cold / @cola Jay White{0} |
 |
|
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2002-10-22 : 11:57:07
|
| you da man!......that looks to be what I (or rather my colleague) want(s).and if it isn't....he'll have to stick with a 2 pass update! |
 |
|
|
|
|
|