need help on data type convertion
Posted in 2008
Topics: Data Types & Schema Design
Hi gurus, So how do we convert data from a text field in table1 to byte field in table2? Can we just alter the table to change the column type from text to byte? Thanks in advance for any suggestion.
On Tue, May 20, 2008 at 2:01 PM, Kern Doe <kern_doe@yahoo.com> wrote: > So how do we convert data from a text field in table1 to byte field in table2? > Can we just alter the table to change the column type from text to byte? It depends a bit on what you want to do, but: SQL[2755]: create table c1(s serial, b byte in table); SQL[2756]: create table c2(s serial, t text in table); SQL[2757]: insert into c2 select s, b from c1; Not definitive - but strongly indicative. -- Jonathan Leffler #include <disclaimer.h> Email: jleffler@earthlink.net, jleffler@us.ibm.com Guardian of DBD::Informix v2008.0229 -- http://dbi.perl.org/ "Blessed are we who can laugh at ourselves, for we shall never cease to be amused." NB: Please do not use this email for correspondence. I don't necessarily read it every week, even.
So I guess the engine does the conversion. Thanks for your reply Jonanthan. ----- Original Message ---- From: Jonathan Leffler <jleffler.iiug@gmail.com> To: ids@iiug.org Sent: Wednesday, May 28, 2008 1:46:32 AM Subject: Re: need help on data type convertion [12226] On Tue, May 20, 2008 at 2:01 PM, Kern Doe <kern_doe@yahoo.com> wrote: > So how do we convert data from a text field in table1 to byte field in table2? > Can we just alter the table to change the column type from text to byte? It depends a bit on what you want to do, but: SQL[2755]: create table c1(s serial, b byte in table); SQL[2756]: create table c2(s serial, t text in table); SQL[2757]: insert into c2 select s, b from c1; Not definitive - but strongly indicative. -- Jonathan Leffler #include <disclaimer.h> Email: jleffler@earthlink.net, jleffler@us.ibm.com Guardian of DBD::Informix v2008.0229 -- http://dbi.perl.org/ "Blessed are we who can laugh at ourselves, for we shall never cease to be amused." NB: Please do not use this email for correspondence. I don't necessarily read it every week, even. ******************************************************************************* Forum Note: Use "Reply" to post a response in the discussion forum.