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)
 DOS filenames in SQL

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-03-12 : 23:05:29
Brian writes "Hi

Running SQL 2000 SP1

How do I find out if a filename exists in DOS?

The best I have come up with is 'dir filename.txt >> file.txt' loading into the db using dts/bcp and checking the record count. There must be a better way.

I want to rename a file but first want to check that it is there. If I run the command and it is not there no @@error is raised.

Cheers Brian"

dsdeming

479 Posts

Posted - 2002-03-13 : 07:50:15
You can use xp_fileexist.

Usage: EXECUTE xp_fileexist <filename> [, <file_exists INT> OUTPUT]

Go to Top of Page
   

- Advertisement -