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 |
|
mj76
Starting Member
8 Posts |
Posted - 2002-11-11 : 16:48:17
|
| Here is my code, followed by what I am trying to do.Select Op1 = Case when uvs = 1 then 'U' else '' End,Op2 = Case when mylars = 1 then 'M' else '' End, Op3 = Case when Foils = 1 then 'F' else '' End , Op4 = Case when windows = 1 then 'W' else '' End, OpFull = Op1 + Op2 + Op3 + Op4^^^^ -- This, in concept is what I need to have, however, it does not recognize the value of the First 4 "op" fields created. The only other way I can think is to test each possibility separately, which is like 35 tests, to test for all possible combinations.I appreciate the help in advanceThanks a million to everyonemj |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2002-11-11 : 19:43:04
|
| OpFull = Case when uvs = 1 then 'U' else '' End + Case when mylars = 1 then 'M' else '' End + ...or you couldselect Op1, Op2, Op3, Op4,OpFull = Op1 + Op2 + Op3 + Op4 from(Select Op1 = Case when uvs = 1 then 'U' else '' End , Op2 = Case when mylars = 1 then 'M' else '' End , Op3 = Case when Foils = 1 then 'F' else '' End , Op4 = Case when windows = 1 then 'W' else '' Endfrom tbl) as a==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|
|
|