Can a column have two column names.
Posted in 2009
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL, Platform-Specific Issues
My version numbers are INFORMIX-4GL Version 7.32.UC2 and INFORMIX Dynamic Server Version 9.40.UC6 and an AIX box A co-worker wants to change the name of a column in a table so that it will work with a large amount of legacy code. I worry that there may be other users that need the particular column name to remain the same. She requires that the table name remain the same so I don't think that I can use a view. I looked at having the new column reference the old column in the same table, but that seems, at the very least, to increase the number of columns by one. That would make the 4gl code upset. Is there a way to have something analogous to a synonym or alias on a column in a table? Thanks for listening to me. -- Randall Young randall.young@arkansas.gov
Randall Young (ADE) wrote:
> My version numbers are INFORMIX-4GL Version 7.32.UC2 and INFORMIX
> Dynamic Server Version 9.40.UC6 and an AIX box
>
>
>
> A co-worker wants to change the name of a column in a table so that it
> will work with a large amount of legacy code. I worry that there may be
> other users that need the particular column name to remain the same.
>
>
>
> She requires that the table name remain the same so I don't think that
> I can use a view. I looked at having the new column reference the old
> column in the same table, but that seems, at the very least, to increase
> the number of columns by one. That would make the 4gl code upset.
>
>
>
> Is there a way to have something analogous to a synonym or alias on a
> column in a table?
Ouch!
Obviously the best thing is to bite the bullet. I can't think of an
easy way to do this offhand. I hate to even make this suggestion, but
here goes....
It *might* be possible to create an empty database in the same instance
and fill it with synonyms which map back to the *real* database. For
the tables in questions, you might map it back to the some other table
and then use a view on that to rename the column in question.
This is a bit of work and a bit messy --- but it *might* just work.
In my test I have a DB named cmpdb and a table as
create table cmptab1(
col1 int primary key,
col2 char(400));
I then did...
create database mydb with log;
create synonym mytab1 for cmpdb:mpruet.cmptab1;
create view cmptab1(mycol1, mycol2)
as select col1, col2 from mytab1;
Like I said - this is a messy solution, but could just work. Maybe
someone else has a better solution.
M.P.
>
>
>
> Thanks for listening to me.
>
>
>
> --
>
>
>
> Randall Young
>
> randall.young@arkansas.gov <mailto:randall.young@arkansas.gov>
>
>
>
>
>
>
>