How should I insert a file to Database?
Posted in 2000
Topics: Server Administration, Data Types & Schema Design
My Informix Dynamic Server is V7.24 on Unix.
I have to insert a file to DB(about 2K). I don't know how should I
realize it.
There is TEXT type in DB,But how can I insert/update the field using a
simple SQL statement?(I can't use some functions that exist in higher
version).
Also,I want to try to use CHAR type. But,a single SQL does not allow
more than 256 bytes in quoted String. And,someone told me to use like
update ls = ls || 'second part of String' to append string. I find
that I can execute it in dbaccess,but it did nothing!!!
And,how should I process special character (such as 'Enter') in SQL
statement? Some data types don't accept unprintable characters.
Need your help!!!
Sent via Deja.com http://www.deja.com/
Before you buy.
minboy@my-deja.com wrote:
>
> My Informix Dynamic Server is V7.24 on Unix.
> I have to insert a file to DB(about 2K). I don't know how should I
> realize it.
> There is TEXT type in DB,But how can I insert/update the field using a
> simple SQL statement?(I can't use some functions that exist in higher
> version).
> Also,I want to try to use CHAR type. But,a single SQL does not allow
> more than 256 bytes in quoted String. And,someone told me to use like
> update ls = ls || 'second part of String' to append string. I find
That should have been:
UPDATE SET ls = trim(ls)|| 'second part of string' ...
> that I can execute it in dbaccess,but it did nothing!!!
> And,how should I process special character (such as 'Enter') in SQL
> statement? Some data types don't accept unprintable characters.
You CAN insert arbitrary data into BLOB columns using 4GL and/or ESQL/C
with no effort at all. Indeed if, as you seem to indicate, the data is
initially in a file, there is a specific loc_type (see the ESQL/C docs)
to load the BLOB directly from the file in ESQL/C. There is example code
in the demo directory where you have installed ESQL/C. Don't be so
stubborn, write a small ESQL/C utility to insert files into tables.
Art S. Kagel
In article <39C915EA.B2B09B90@bloomberg.net>,
kagel@bloomberg.net wrote:
> minboy@my-deja.com wrote:
> >
> > My Informix Dynamic Server is V7.24 on Unix.
> > I have to insert a file to DB(about 2K). I don't know how should I
> > realize it.
> > There is TEXT type in DB,But how can I insert/update the field
using a
> > simple SQL statement?(I can't use some functions that exist in
higher
> > version).
> > Also,I want to try to use CHAR type. But,a single SQL does not allow
> > more than 256 bytes in quoted String. And,someone told me to use
like
> > update ls = ls || 'second part of String' to append string. I find
>
> That should have been:
>
> UPDATE SET ls = trim(ls)|| 'second part of string' ...
Thank you,I succeed.
>
> > that I can execute it in dbaccess,but it did nothing!!!
> > And,how should I process special character (such as 'Enter') in SQL
> > statement? Some data types don't accept unprintable characters.
>
> You CAN insert arbitrary data into BLOB columns using 4GL and/or
ESQL/C
> with no effort at all. Indeed if, as you seem to indicate, the data
is
> initially in a file, there is a specific loc_type (see the ESQL/C
docs)
> to load the BLOB directly from the file in ESQL/C. There is example
code
> in the demo directory where you have installed ESQL/C. Don't be so
> stubborn, write a small ESQL/C utility to insert files into tables.
Thanks,I'll try it.
> Art S. Kagel
>
Sent via Deja.com http://www.deja.com/
Before you buy.