MSSQLCity.Com - All about MS SQL
     
About Us  
SSWUG Articles  
Articles  
FAQ  
Administration  
Backup/Restore  
Connectivity  
Development  
General  
Installation  
OLAP  
Replication  
Transfer/move  
Trouble  
SQL 6.5  
Scripts  
Tips  
Test Exams  
Advertise  
Download  
History  
Search  
Traffic  
Related Links  
     
Your button logo
Add to Favorites
 
     
 


How can I check from the SQL Server whether the file exists or not?

Answer:

You can use the xp_fileexist undocumented extended stored procedure to determine whether the particular file exists on the disk or not.

Syntax:

EXECUTE xp_fileexist filename [, file_exists INT OUTPUT]

To check whether the file boot.ini exists on the disk C: or not, run:

EXEC master..xp_fileexist 'c:\boot.ini'

There are many extended stored procedures shipped with SQL Server and not all of them have been described in the SQL Server manuals. See this article to get the useful undocumented extended stored procedures description:
Useful undocumented extended stored procedures


 

 
Visit The SQL Server Worldwide User's Group for all the latest news and information about SQL Server, Oracle, DB2 and XML for developers and administrators.

(c) 1997, 2005 Bits on the Wire, Inc