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 |
|
tpiazza55
Posting Yak Master
162 Posts |
Posted - 2012-01-06 : 13:15:37
|
| i have a table that has the following columnstransid key valueso data exist liketransid key value 1 key1 value1 1 key2 value2 1 key3 value3how would i update values for 2 different key in one update statement |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
tpiazza55
Posting Yak Master
162 Posts |
Posted - 2012-01-06 : 13:21:32
|
| before transid key value1 key1 value1 1 key2 value21 key3 value3aftertransid key value1 key1 value1_new 1 key2 value21 key3 value3_new |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
tpiazza55
Posting Yak Master
162 Posts |
Posted - 2012-01-06 : 13:24:29
|
| can you do something with a case statement and update the value twice in one update?likeSET Value = CASE WHEN key = 'key1' THEN 'value1_new' END,Value = CASE WHEN key = 'key3' THEN 'value3_new' END, |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
tpiazza55
Posting Yak Master
162 Posts |
Posted - 2012-01-06 : 13:27:10
|
| the new values come from a join on anther table |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
|
|
|