This is a discussion on DECODE in SQL Server?" within the SQL Server forums, part of the Microsoft SQL Server category; --> "DHatheway" <dlhatheway@mmm.com.nospam> wrote in message news:ck18oi$m31$1@tuvok3.mmm.com... > "Daniel Morgan" <damorgan@x.washington.edu> wrote in message > news:1096932539.547042@yasure... > > N wrote: ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| "DHatheway" <dlhatheway@mmm.com.nospam> wrote in message news:ck18oi$m31$1@tuvok3.mmm.com... > "Daniel Morgan" <damorgan@x.washington.edu> wrote in message > news:1096932539.547042@yasure... > > N wrote: > > > What is the function in SQL that works like DECODE in Oracle?" > > > Thanks, > > > > > > N > > > > As you know CASE is not the same as DECODE ... but SQL Server hsa no > > functionality equivalent to DECODE so you will have to adapt CASE to > > do the job. > > -- > > Daniel A. Morgan > > University of Washington > > damorgan@x.washington.edu > > (replace 'x' with 'u' to respond) > > > > OK, then, what does DECODE do? > DECODE( exp, search1, result1 [,search2, result2]... ) is semantically equivalent to: CASE exp when search1 then result1 when search2 then result2 ... END The difference between CASE and DECODE is that CASE also allows the form: CASE WHEN exp1 = search1 then result1 WHEN exp2 = search2 then result2 ... END DECODE can't do that. -- Paul Horan[TeamSybase] VCI Springfield, Mass www.vcisolutions.com |
| Thread Tools | |
| Display Modes | |
|
|