//
you're reading...
SQL Server

xp_fileExists false negative

 

Running the extended stored procedure xp_fileexist returned a negative result enen though the file existed on disk.

exec master..xp_fileexist ‘C:\SQLBackup\msdb.bak’

returns:

File Exists File is a Directory Parent Directory Exists

———– ——————- ———————–

0           0                   1

 

(1 row(s) affected)

To fix

1 – confirm that the file name in the xp is valid – for example, paste the name into notepad and open it.

2 – confirm that the account SQL Server is running under has permissions on the directory.

3 – if appropriate, investigate the credentials of the user running the command.

In my case, the SQL Server service did not have permissions on the backup directory. I used Windows Explorer to give the sQL Server service account a minimal level of permissions.

About iantreasure

DBA with 25 years experience (SQL Server, Oracle).

Discussion

No comments yet.

Leave a comment