[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: Loading text files via SQR



On Fri, 9 Mar 2001, McCown, Larry wrote:

> Hello,
> I am importing data into the Maximo 4.0.3 database SQLServer 7.0 via SQR.  I
> have 2 CSV files that are being opened and values are being loaded.  My
> problem is that I have 5400+ TXT files that need to be loaded along with
> these CSV files (these will be going into the LDTEXT).
> I am looking for help/suggestions on how to make SQR look at 5400+ TXT files
> without have to identify (open and close) each file individually in the
> program.

If all the text files are or can be moved into a specified directory, then
you can use "call system using" to get a listing of that directory (with
just the bare filenames) redirected to a file.  After that, open the file
you redirected to, and read in the filenames one at a time.  For every
filename it reads, call a procedure that opens that text file and saves
the data into Maximo.

> I also need some guidance on what I need to do different with a TXT file
> versus a CSV file in the insert and values statements within my begin-sql.

Depends on whether the text files are fixed width or delimited.  Once the
values are in variables, the begin-sql works the same way.

HTH,
-----------------------------------------------------------------------
Donald Mellen  | Ray Ontko & Co. - Richmond, IN - http://www.ontko.com/
donm@ontko.com |  "In the beginning, there was nothing, which exploded"