• Subject: Re: SQL question
  • From: Benjamin Budai <BENJI@xxxxxxxxxxxxxx>
  • Date: Mon, 15 Jan 2001 16:54:48 +0100
  • Date: Mon, 15 Jan 2001 16:54:47 +0100



On Mon, 15 Jan 2001, Bart Verweijen wrote:

> Hi all,
> 
> I have a file with following kind of records:
> Cmp = num field
> Item= char field
> eancode=char field
> type=num field
> 
> I need a SQL that copies all this data to a new type where the eancode
> length = 13.
>
Hi Bart,

The simplest way is using ALTER TABLE, but this doesn't copy your data, 
it simply changes the column definition:

ALTER TABLE lib/file ALTER COLUMN eancode SET DATA TYPE CHAR(13) 

If you don't want to do this in place then CRTDUPOBJ the file first, and 
alter the copy. Another way to do this is to CREATE TABLE the file with 
the new layout, then do an INSERT with subselect like this:

INSERT INTO newfile SELECT * FROM oldfile

Hope this helps.

Benjamin Budai
 
> Is this possible ?
> 
> Thanx for yer time !
> Bart
> 
> +---
> | This is the Midrange System Mailing List!
> | To submit a new message, send your mail to MIDRANGE-L@midrange.com.
> | To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
> | To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
> | Questions should be directed to the list owner/operator: david@midrange.com
> +---
> 
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2020 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].