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 |
mayoorsubbu
Yak Posting Veteran
95 Posts |
Posted - 2008-02-23 : 04:24:57
|
Is there a more elegant way to replace the statement belowSelect distinct storecode, itemcode, 'Location' = Ltrim(Rtrim(CASE WHEN Shed='N/A' THEN '' ELSE + ' ' + Shed + ' ' + Case level1 when 'N/A' then '' Else ' ' + Level1 + ' ' + Case Bay when 'N/A' then '' Else ' ' + Bay + ' ' + Case Row when 'N/A' then '' Else ' ' + Row + ' ' + Case Rack when 'N/A' then '' Else ' ' + Rack + ' ' + Case Shelf when 'N/A' then '' Else ' ' + Shelf + ' ' + Case Tray when 'N/A' then '' Else ' ' + Tray + ' ' End End End End End End END))FROM <tablename> where <condition> |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-02-23 : 06:14:05
|
TrySelect distinct storecode, itemcode, replace(replace(Shed+level1+bay+...tray,' ',''),'N/A','') from <tablename> where <condition>MadhivananFailing to plan is Planning to fail |
|
|
mayoorsubbu
Yak Posting Veteran
95 Posts |
Posted - 2008-02-24 : 04:33:01
|
Thank you Madhi |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-02-25 : 03:02:45
|
quote: Originally posted by mayoorsubbu Thank you Madhi
You are welcome MadhivananFailing to plan is Planning to fail |
|
|
|
|
|