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 |
|
asif372
Posting Yak Master
100 Posts |
Posted - 2011-03-17 : 14:42:09
|
| I Have A Table naming CheckInOut like this(UserID) (CheckTime) (Checktype)(1) (10/18/2010 2:39:08 PM) (I)(1) (10/18/2010 9:12:46 PM) (o)(1) (10/19/2010 8:56:21 AM) (I)(1) (10/20/2010 8:50:21 AM) (I)(1) (10/20/2010 8:24:13 PM) (O)i want to update CheckType using these condition update table where chectype='I' Set CheckType='O' and where checktype='O' Set CheckType='I' i am using this query but first one update checktype where CheckType='O' to 'I' and then update all to 'O' i want to update I to O and O to I any Ideas?????update CheckInOut Set CheckType='I' where CheckType='O'update CheckInOut Set CheckType='O' where CheckType='I'Thanks In Advance |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2011-03-17 : 14:50:33
|
| update CheckInOut Set CheckType=CASE WHEN CheckType='O' THEN 'I' WHEN CheckType='I' THEN 'O' ELSE CheckType END |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
asif372
Posting Yak Master
100 Posts |
Posted - 2011-03-17 : 15:05:46
|
| Thanks A Lot Its Working Fine |
 |
|
|
|
|
|