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
 SQL Server Development (2000)
 BCP keeping input file-handle open

Author  Topic 

JPD
Starting Member

1 Post

Posted - 2003-12-11 : 00:21:26
I have a *cmd script that runs on a NT2000 server. It has four staements that connect to a SQL2000 box (osql,bcp,osql,osql). Each statement uses the same ID/PW, and the *cmd script is run daily via NT scheduler.

The BCP statement imports data from a text-file (call it mydata.txt) into a server table. Most of the time all works well, but about once a week the ID is shown as still having the file mydata.txt open. This causes another process that overwrites the file mydata.txt with new data to fail (due to a sharing violation). The NT administrator has to close the file through Task Manager by killing the thread.

This will reveal itself the following day. It seems everything else runs fine but BCP (presuming that is the culprit since it is the only command that uses that particular ID when using the file) doesn't release the open-handle to the text file.

Any input/advice would be much appreciated....Thanks!

nr
SQLTeam MVY

12543 Posts

Posted - 2003-12-11 : 05:01:59
Odd I've nnever come across that and have a lot of implementations which bulk insert files then move them to an archive directory.
Have a look at
http://www.nigelrivett.net/ImportTextFiles.html

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -