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 |
duhaas
Constraint Violating Yak Guru
310 Posts |
Posted - 2007-06-25 : 10:35:13
|
trying to update a table using the following:use IMCMFTPupdate RES_ATTRset RES_CODE = case RES_CODEwhen 'SR1' then 'SR1____' when 'SR2' then 'SR2____' when 'SR3' then 'SR3____'end;where RES_CODE in ('SR1','SR2','SR3')doesnt appear i have my where syntax in the proper location, i essentially want to only update the records that have those RES_CODES |
|
Ifor
Aged Yak Warrior
700 Posts |
Posted - 2007-06-25 : 10:49:29
|
[code]UPDATE RES_ATTRSET RES_CODE = RES_CODE + '____'WHERE RES_CODE in ('SR1','SR2','SR3')[/code] |
 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-06-25 : 10:50:51
|
[code]UPDATE RES_ATTRSET RES_CODE = CASE RES_CODE WHEN 'SR1' THEN 'SR1____' WHEN 'SR2' THEN 'SR2____' WHEN 'SR3' THEN 'SR3____' ENDWHERE RES_CODE IN ('SR1','SR2','SR3')[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-06-25 : 10:51:30
|
 KH[spoiler]Time is always against us[/spoiler] |
 |
|
duhaas
Constraint Violating Yak Guru
310 Posts |
Posted - 2007-06-25 : 11:04:00
|
thanks as always |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-06-25 : 11:04:04
|
Or just remove the semicolon after the END keyword?Peter LarssonHelsingborg, Sweden |
 |
|
|
|
|