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.

Server side column alias

4 posts in General Discussion Last posting was on 2009-04-02 15:38:04.0Z
Kyle Danielson Posted on 2009-04-01 22:45:37.0Z
Sender: 7df5.49d3ecb0.1804289383@sybase.com
From: Kyle Danielson
Newsgroups: ianywhere.public.general
Subject: Server side column alias
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <49d3ee91.7e48.1681692777@sybase.com>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 1 Apr 2009 14:45:37 -0800
X-Trace: forums-1-dub 1238625937 10.22.241.41 (1 Apr 2009 14:45:37 -0800)
X-Original-Trace: 1 Apr 2009 14:45:37 -0800, 10.22.241.41
Lines: 11
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:7466
Article PK: 5880

Is there a method to have a column which supports two names.
A real name and an alias. This is for backward
compatibility so stored procedures will not help. The
example for this problem is middle initial and now wanting
to support middle name. I need the middle initial there for
older versions of the product, but I do not want to have my
middle name field to be called middle initial. Currently
I'm looking at supporting two fields at once, but I wanted
to see if there were any other ideas.

Kyle


Breck Carter [TeamSybase] Posted on 2009-04-02 09:12:31.0Z
From: "Breck Carter [TeamSybase]" <NOSPAM__breck.carter@gmail.com>
Newsgroups: ianywhere.public.general
Subject: Re: Server side column alias
Organization: RisingRoad Professional Services
Reply-To: NOSPAM__breck.carter@gmail.com
Message-ID: <h809t41br91v6argthrqan1p8vfanct2bo@4ax.com>
References: <49d3ee91.7e48.1681692777@sybase.com>
X-Newsreader: Forte Agent 2.0/32.640
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Date: 2 Apr 2009 01:12:31 -0800
X-Trace: forums-1-dub 1238663551 10.22.241.152 (2 Apr 2009 01:12:31 -0800)
X-Original-Trace: 2 Apr 2009 01:12:31 -0800, vip152.sybase.com
Lines: 41
X-Authenticated-User: TeamSybase
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:7467
Article PK: 5881

One way might be to create a view. If you want to preserve the table
name then the view could have the same name but a different owner.

Another possibility might be a COMPUTE column...

CREATE TABLE t (
pkey INTEGER NOT NULL DEFAULT AUTOINCREMENT PRIMARY KEY,
middle_name VARCHAR ( 100 ) NOT NULL DEFAULT '',
middle_initial VARCHAR ( 100 ) COMPUTE ( LEFT ( middle_name, 1 ) )
);

INSERT t ( middle_name ) VALUES ( 'Fred' );

SELECT * FROM t;

pkey,middle_name,middle_initial
1,'Fred','F'

Breck

On 1 Apr 2009 14:45:37 -0800, Kyle Danielson wrote:

>Is there a method to have a column which supports two names.
> A real name and an alias. This is for backward
>compatibility so stored procedures will not help. The
>example for this problem is middle initial and now wanting
>to support middle name. I need the middle initial there for
>older versions of the product, but I do not want to have my
>middle name field to be called middle initial. Currently
>I'm looking at supporting two fields at once, but I wanted
>to see if there were any other ideas.
>
>Kyle

--
Breck Carter http://sqlanywhere.blogspot.com/

RisingRoad SQL Anywhere and MobiLink Professional Services
breck.carter@risingroad.com


Kyle Danielson Posted on 2009-04-02 15:21:48.0Z
Sender: 7df5.49d3ecb0.1804289383@sybase.com
From: Kyle Danielson
Newsgroups: ianywhere.public.general
Subject: Re: Server side column alias
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <49d4d80c.15ba.1681692777@sybase.com>
References: <h809t41br91v6argthrqan1p8vfanct2bo@4ax.com>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 2 Apr 2009 07:21:48 -0800
X-Trace: forums-1-dub 1238685708 10.22.241.41 (2 Apr 2009 07:21:48 -0800)
X-Original-Trace: 2 Apr 2009 07:21:48 -0800, 10.22.241.41
Lines: 11
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:7469
Article PK: 5883

> Another possibility might be a COMPUTE column...

Sure, this is still a two column solution.

I did have an issue with compute. I can not capture
attempts to modify the middle initial by the older systems.
In triggers the Middle initial was always the computed
value, not the value that the older system was setting it
to.

Kyle


Breck Carter [TeamSybase] Posted on 2009-04-02 15:38:04.0Z
From: "Breck Carter [TeamSybase]" <NOSPAM__breck.carter@gmail.com>
Newsgroups: ianywhere.public.general
Subject: Re: Server side column alias
Organization: RisingRoad Professional Services
Reply-To: NOSPAM__breck.carter@gmail.com
Message-ID: <ltm9t49bohvvpsh4emd4aru75ugddpp57q@4ax.com>
References: <h809t41br91v6argthrqan1p8vfanct2bo@4ax.com> <49d4d80c.15ba.1681692777@sybase.com>
X-Newsreader: Forte Agent 2.0/32.640
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Date: 2 Apr 2009 07:38:04 -0800
X-Trace: forums-1-dub 1238686684 10.22.241.152 (2 Apr 2009 07:38:04 -0800)
X-Original-Trace: 2 Apr 2009 07:38:04 -0800, vip152.sybase.com
Lines: 25
X-Authenticated-User: TeamSybase
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:7470
Article PK: 5882

Perhaps you could explain your needs in more detail.

Is there a reason you can't use a view?

Breck

On 2 Apr 2009 07:21:48 -0800, Kyle Danielson wrote:

>> Another possibility might be a COMPUTE column...
>
>Sure, this is still a two column solution.
>
>I did have an issue with compute. I can not capture
>attempts to modify the middle initial by the older systems.
>In triggers the Middle initial was always the computed
>value, not the value that the older system was setting it
>to.
>
>Kyle

--
Breck Carter http://sqlanywhere.blogspot.com/

RisingRoad SQL Anywhere and MobiLink Professional Services
breck.carter@risingroad.com