Re: Importing fixed-length ASCII data
Posted in 1992
Topics: Server Administration
In article <8781@emory.mathcs.emory.edu>, walt@mathcs.emory.edu (Walt Hultgren {rmy}) writes: |> Forwarded from Shane Trammel <trammel@riogrande.cs.tcu.edu>: |> |> I need to import a fixed length ascii file into a database. |> |> My problem: I only want certain fields to be imported, not the |> whole thing. Can I selectively pick the fields I want. |> |> i.e f0 1-30 { name } |> f1 50-60 { address } |> f2 100-115 { company } |> |> Could someone please give me the proper systanx if it is |> possible to do what I am describibg. |> |> |> Thanks |> |> Shane Trammel |> email: trammel@riogrande.cs.tcu.edu My first choice would be to use UNIX tools to format the file so that I could load it in a straightforward manner. Another way would be to load everything into a temporary table, one field per record (all one big string) and cut it up with a select statement and insert the results into the real table. The trouble with this is you might possibly have to contend with converting string data to numeric data somewhere along the line, depending on what the fields are in the real table. ------------------------------------------------------------------------------ John R. Carter, Sr. Programmer/Analyst - Informix DBA Computer Sciences Corporation jcarter@nas.nasa.gov Numerical Aerodynamic Simulation 415/604-3662 NASA Ames Research Center, Moffett Field, CA 94035-1000 M/S 258-6 ------------------------------------------------------------------------------