+ Reply to Thread
Results 1 to 4 of 4

Narrowing using create table select

  1. Narrowing using create table select

    If I have a table with a c24 field that I would like to remake as a
    c20,
    in some other db's I would use padr(field,20) which seems to not be
    available in Ingres. My next thought was to use cast like:

    create table narrowed as
    select cast(field as char(20)) as field
    from original

    but the result is still a c24 field.

    If anyone knows how to do this in Ingres, I would be quite grateful!

    Thanks,
    John

  2. Re: [Info-Ingres] Narrowing using create table select

    2008/11/13 NicknameIsNotAvailableInThisGroup

    > If I have a table with a c24 field that I would like to remake as a
    > c20,
    > in some other db's I would use padr(field,20) which seems to not be
    > available in Ingres. My next thought was to use cast like:
    >
    > create table narrowed as
    > select cast(field as char(20)) as field
    > from original
    >
    > but the result is still a c24 field.
    >
    > If anyone knows how to do this in Ingres, I would be quite grateful!
    >



    CREATE TABLE narrowed AS
    SELECT CHAR(field, 20) AS field
    FROM original



    --
    Paul Mason


  3. Re: [Info-Ingres] Narrowing using create table select

    Hi John

    alter table alter column

    But that depends upon what version of Ingres you are running.

    If there are any views that hang off the table you'll need to redefine
    them.

    Martin Bowes

    -----Original Message-----
    From: info-ingres-bounces@kettleriverconsulting.com
    [mailto:info-ingres-bounces@kettleriverconsulting.com] On Behalf Of
    NicknameIsNotAvailableInThisGroup
    Sent: 13 November 2008 14:26
    To: info-ingres@kettleriverconsulting.com
    Subject: [Info-Ingres] Narrowing using create table select

    If I have a table with a c24 field that I would like to remake as a
    c20,
    in some other db's I would use padr(field,20) which seems to not be
    available in Ingres. My next thought was to use cast like:

    create table narrowed as
    select cast(field as char(20)) as field
    from original

    but the result is still a c24 field.

    If anyone knows how to do this in Ingres, I would be quite grateful!

    Thanks,
    John
    _______________________________________________
    Info-Ingres mailing list
    Info-Ingres@kettleriverconsulting.com
    http://www.kettleriverconsulting.com...fo/info-ingres


  4. Re: Narrowing using create table select

    On Nov 13, 8:40*am, "Paul Mason" wrote:
    > 2008/11/13 NicknameIsNotAvailableInThisGroup
    >
    > > If I have a table with a c24 field that I would like to remake as a
    > > c20,
    > > in some other db's I would use padr(field,20) which seems to not be
    > > available in Ingres. *My next thought was to use cast like:

    >
    > > *create table narrowed as
    > > * *select cast(field as char(20)) as field
    > > * * from original

    >
    > > but the result is still a c24 field.

    >
    > > If anyone knows how to do this in Ingres, I would be quite grateful!

    >
    > CREATE TABLE narrowed AS
    > SELECT CHAR(field, 20) AS field
    > FROM original
    >
    > --
    > Paul Mason


    Thank you, that worked perfectly!

    John

+ Reply to Thread