dbaspot
Tags Register FAQ Calendar Search Today's Posts Mark Forums Read

Narrowing using create table select - Ingres Database

This is a discussion on Narrowing using create table select - Ingres Database ; 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 ...


Home > Database Forum > Other Databases > Ingres Database > Narrowing using create table select

Reply

 

LinkBack Thread Tools Display Modes
  #1  
Old 11-13-2008, 10:26 AM
Database Bot
 
Join Date: Sep 2009
Posts: 1,236,254
Database Administrator is on a distinguished road
Default 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
Reply With Quote
  #2  
Old 11-13-2008, 10:40 AM
Database Bot
 
Join Date: Sep 2009
Posts: 1,236,254
Database Administrator is on a distinguished road
Default 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

Reply With Quote
  #3  
Old 11-13-2008, 11:57 AM
Database Bot
 
Join Date: Sep 2009
Posts: 1,236,254
Database Administrator is on a distinguished road
Default 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

Reply With Quote
  #4  
Old 11-13-2008, 04:19 PM
Database Bot
 
Join Date: Sep 2009
Posts: 1,236,254
Database Administrator is on a distinguished road
Default 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 With Quote
Reply

Thread Tools
Display Modes



All times are GMT -4. The time now is 08:01 AM.