text datatype question
Posted in 2000
Topics: Versions, Editions & End-of-Life
We are setting up a batch process that would create tab delimited text files . I then need to take the contents of the text file and get it into a TEXT field Table 1 might be defined as follows -------- id int, desc char 30, report text and already contain a row like : 1, My Sample Report, NULL (nothing in the TEXT field yet) I then run the batch and save the output to : file => /.../.../AB01012000.txt How would I get the contents of AB01012000 into the table w/ an UPDATE statement TIA IDS 7.3
one way to do the update is to use esql/c , see the loc_t structure for details. Nona >Subject: text datatype question >From: "Michael Talbot" michael.talbot@telops.gte.com >Date: 12.04.00 19:50 W. Europe Daylight Time >Message-id: <8d2d0c$rds$1@news.gte.com> > >We are setting up a batch process that would create tab delimited text files >. I then need to take the contents of the text file and get it into a TEXT >field > >Table 1 might be defined as follows >-------- >id int, >desc char 30, >report text > >and already contain a row like : > >1, My Sample Report, NULL (nothing in the TEXT field yet) > >I then run the batch and save the output to : > >file => /.../.../AB01012000.txt > >How would I get the contents of AB01012000 into the table w/ an UPDATE >statement > >TIA > >IDS 7.3 > > > >
Its not clear to me whether AB01012000 contains multiple rows. If it does,
presumably each has an identifier besides the TEXT data. One method you could
use is the following :
Load the contents of AB01012000 into a temporary table that has the identifier
columns and the TEXTcolumn using dbaccess's LOAD command.
Then, use an update statement as follows
UPDATE <target_table>
SET (report) =
((SELECT <text_column> FROM <tmp_table>
WHERE <target_table>.identifier = <tmp_table>.identifier))
WHERE EXISTS
(SELECT 1 FROM <tmp_table>
WHERE <target_table>.identifier = <tmp_table.identifier);
Finally, drop the temporary table.
Rudy
Michael Talbot wrote:
> We are setting up a batch process that would create tab delimited text files
> . I then need to take the contents of the text file and get it into a TEXT
> field
>
> Table 1 might be defined as follows
> --------
> id int,
> desc char 30,
> report text
>
> and already contain a row like :
>
> 1, My Sample Report, NULL (nothing in the TEXT field yet)
>
> I then run the batch and save the output to :
>
> file => /.../.../AB01012000.txt
>
> How would I get the contents of AB01012000 into the table w/ an UPDATE
> statement
>
> TIA
>
> IDS 7.3
Michael Talbot wrote: > We are setting up a batch process that would create tab delimited text files > . I then need to take the contents of the text file and get it into a TEXT > field > > Table 1 might be defined as follows > -------- > id int, > desc char 30, > report text > > and already contain a row like : > > 1, My Sample Report, NULL (nothing in the TEXT field yet) > > I then run the batch and save the output to : > > file => /.../.../AB01012000.txt > > How would I get the contents of AB01012000 into the table w/ an UPDATE > statement I'm not sure I fully understand the scenario, but in 7.3, you cannot simply update a blob from a file with DB-Access. You can do it in ESQL/C. In fact, there's even a demo program called UPDBLOB in the SQLCMD code that does precisely that, for one blob in one invocation. You could probably hack that to do what you need if you're using ESQL/C. -- Jonathan Leffler (jleffler@informix.com, jleffler@earthlink.net) Guardian of DBD::Informix v1.00.PC1 -- see http://www.perl.com/CPAN #include <disclaimer.h>