usual way to check if file existsDECLARE @File_Exists INT EXEC Master.dbo.xp_fileexist '\\serverB\SQL_Backup\file.bak', @File_Exists OUT print @File_Exists1And if check folder, can use "nul", but it doesn't work for UNC pathDECLARE @File_Exists INT EXEC Master.dbo.xp_fileexist '\\serverB\SQL_Backupul', @File_Exists OUT print @File_Exists0If use xp_subdirs like: EXEC master.dbo.xp_subdirs '\\serverB\SQL_Backups'If the folder doesn't exists,Msg 22006, Level 16, State 1, Line 3xp_subdirs could not access '\\ServerB\SQL_Backups\*.*': FindFirstFile() returned error 67, 'The network name cannot be found.'Any ideas how to check if UNC folder exists in Backup? in my code I want to check if the unc folder exists before doing backup, the unc path is retrieved from other table or backup history.
↧