Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to check for existance of a text file. 1

Status
Not open for further replies.

MarkButler

Programmer
Feb 22, 2001
83
US
I want to check for the existance of a text file, the file name being passed to a stored procedure. If the file exists inport it and archive it, if not do an early exit.

Do I just need to act on it as though it exists and catch the error or is there a cleaner way?

Thanx
Mark
 
Correction; For SQL Server 2000 the command is

sp_MSget_file_existence file_path_and_name

e.g. sp_MSget_file_existence 'c:\temp\myfile.txt'

I haven't been able to get this to work with UNC file paths though (e.g. \\MyComputer\MyComputer_C\temp\myfile.txt), so the files will need to be on a mapped network drive to the server.

Hope that helps




Nathan

[yinyang]
 
Hi, this might be of interest, then again it might not

if you run

sp_helptext 'sp_MSget_file_existence'


it shows exactly what the proc does to test for file existance.

Regards

mysticmart
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top