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 |
shubhada
Posting Yak Master
117 Posts |
Posted - 2008-02-26 : 04:23:02
|
I have one table with column IsMarried and value for this column is 'Y' and 'N'.but by mistake data entered in this column is wrong.also this table have milion records. Considering performance .How I can swap the value of IsMarried column.current it is as followcol1 colname IsMarried1 abc Y2 xyz N3 pqr N4 lmn y...but it should be as followcol1 colname IsMarried1 abc N2 xyz Y3 pqr Y4 lmn N...SQLTeam |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-02-26 : 04:25:26
|
UPDATE TableSET IsMarried=CASE WHEN IsMarried='Y' THEN 'N' ELSE 'Y' END |
 |
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2008-02-26 : 04:26:02
|
[code]UPDATE TABLESET COL = CASE WHEN COL = 'Y' THEN 'N' ELSE 'Y' ENDWHERE COL IN ('Y','N')[/code]Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
|
|