Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 Import from text file

Author  Topic 

pbaldy
Starting Member

7 Posts

Posted - 2007-02-14 : 17:32:41
Short version: I have process that works using a batch file and isqlw in DOS, but seems to hang itself up and fails to run the next time.

Long version: I am trying to automate a nightly import of data. The text file has this format:

INSERT INTO Table1 VALUES (1, 2, 3)
INSERT INTO Table1 VALUES (4, 5, 6)

INSERT INTO Table2 VALUES (1, 2, 3, 4)
INSERT INTO Table2 VALUES (5, 6, 7, 8)

All told there are roughly 25,000 lines inserting data into 10 different tables. I currently have a batch file that works, but seems to leave a process running or something. It will run tonight and then may not run tomorrow. It uses this line:

isqlw -d DatabaseName -U sa -P password -i final.txt -o appends.txt

I wondered if DTS could import this data instead of the batch file, which might fix my problem with the batch file failing to run sometimes.

Paul

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2007-02-14 : 17:48:56
Can you modify the text file? Instead of INSERT statements, can the rows be comma separated values that way you can use BULK INSERT or bcp?

It's hard to know if DTS will help you out any as we don't know
what's wrong with the batch file.

BTW, you should be using osql instead of isql. isql is for 7.0 or earlier. osql is for 2000. And now we've got sqlcmd for 2005.

Tara Kizer
Go to Top of Page

pbaldy
Starting Member

7 Posts

Posted - 2007-02-14 : 18:13:23
Thanks for your help. I'll look into changing the text file. It's a dump of data from a website hosting company (earlier steps in the batch file FTP it down and tweak it a little). Because there are numerous tables involved, I imagine I'd need a separate file for each one, which would complicate the rest of the process.

The batch file does work, it just seems to leave itself open sometimes. It actually worked fine for a while. I think the growth in data has caused the problem.

I will look at osql, as we have 2000. I started out using isql, which worked until the data got to a certain size and then I got memory errors. isqlw solved that, but now I have this issue. Perhaps osql will fix it.

Thanks again!

Paul
Go to Top of Page

pbaldy
Starting Member

7 Posts

Posted - 2007-02-20 : 13:28:42
As a follow up, changing to osql seems to have fixed it. The batch file has run for several days without problems. Thanks for the help!

Paul
Go to Top of Page
   

- Advertisement -