Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

decode function?

2 posts in Windows NT Last posting was on 2000-02-01 00:56:19.0Z
John Wang Posted on 2000-01-31 21:04:38.0Z
From: "John Wang" <wang_john@bah.com>
Subject: decode function?
Date: Mon, 31 Jan 2000 16:04:38 -0500
Lines: 16
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2314.1300
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
Message-ID: <tDgpW8Cb$GA.184@forums.sybase.com>
Newsgroups: sybase.public.sqlserver.nt
NNTP-Posting-Host: aln-45-243.usae.bah.com 156.80.45.243
Path: forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.sqlserver.nt:2602
Article PK: 1090057

Hi, all:

I am using sybase 11.5 enterprise on NT. Is there a decode function in
sybase, like the one in Oracle? The problem is this, i have 2 columns in
the table, the value of the third column is based on the value of column 2,
the oracle's decode function would look like this,
select column1, column2, decode(column2,null,column2,column1) as column3
from table.

I am looking for an equivalent function in sybase. Is there one?

Thanks

john wang.


Mark A. Parsons Posted on 2000-02-01 00:56:19.0Z
Message-ID: <38962F33.C8C1C942@compuserve.com>
Date: Tue, 01 Feb 2000 13:56:19 +1300
From: "Mark A. Parsons" <iron_horse@compuserve.com>
Organization: Pegasys Ltd
X-Mailer: Mozilla 4.61 [en] (Win98; U)
X-Accept-Language: en
MIME-Version: 1.0
Subject: Re: decode function?
References: <tDgpW8Cb$GA.184@forums.sybase.com>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Newsgroups: sybase.public.sqlserver.nt
Lines: 17
NNTP-Posting-Host: p376.ipa1-n8-16.iconz.net.nz 210.48.25.120
Path: forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.sqlserver.nt:2600
Article PK: 1090054


John Wang wrote:
>
> Hi, all:
>
> I am using sybase 11.5 enterprise on NT. Is there a decode function in
> sybase, like the one in Oracle? The problem is this, i have 2 columns in
> the table, the value of the third column is based on the value of column 2,
> the oracle's decode function would look like this,
> select column1, column2, decode(column2,null,column2,column1) as column3
> from table.
>
> I am looking for an equivalent function in sybase. Is there one?
>
> Thanks
>
> john wang.

Check out the 'case' statement ... this should give you similar
functionality.

--
Mark Parsons
Pegasys Ltd