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 |
|
sqllover
Constraint Violating Yak Guru
338 Posts |
Posted - 2008-04-11 : 06:33:53
|
hi, i need to update my table values with difference condions at a timeexample:"update ChSetting set Interrupted_Level=" & CInt(ThresholdControl22.HeightThresholdBox) & " where Interrupted_Decition='" & intSensorSerialNo & "' and Interrupted_Decition='1')""update ChSetting set Interrupted_Level=" & CInt(ThresholdControl23.HeightThresholdBox) & " where Interrupted_Decition='" & intSensorSerialNo & "' and Interrupted_Decition='0')""update ChSetting set Interrupted_Level=" & CInt(ThresholdControl24.HeightThresholdBox) & " where Interrupted_Decition='" & intSensorSerialNo & "' and Interrupted_Decition='2')" if means please give me some sample wa to do this please |
|
|
elancaster
A very urgent SQL Yakette
1208 Posts |
Posted - 2008-04-11 : 06:45:35
|
| do you know how to write a CASE expression?Em |
 |
|
|
sqllover
Constraint Violating Yak Guru
338 Posts |
Posted - 2008-04-11 : 06:50:29
|
| yes i know friend but in this situation i need help please give me sample query |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2008-04-11 : 06:53:50
|
| Don't use dynamically build sql statements. Make use of stored proc.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
sqllover
Constraint Violating Yak Guru
338 Posts |
Posted - 2008-04-11 : 06:58:07
|
| ok friend thanks for the reply |
 |
|
|
jezemine
Master Smack Fu Yak Hacker
2886 Posts |
Posted - 2008-04-13 : 01:47:10
|
[code]update ChSetting set Interrupted_Level=case when Interrupted_Decition=0 then 'aaa' when Interrupted_Decition=1 then 'bbb' when Interrupted_Decition=2 then 'ccc'endwhere Interrupted_Decition in (0,1,2)[/code] elsasoft.org |
 |
|
|
|
|
|