Intermittently, a Backup Database task in a maintenance plan raises the following error (taken from extended log):
Failed:(-1073548784) Executing the query "EXECUTE master.dbo.xp_create_subdir N'\\\\backupserver\\backupshare$\\sqlservername$instancename\\dbname'
" failed with the following error: "xp_create_subdir() returned error 123, 'The filename, directory name, or volume label syntax is incorrect.'". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
In the task, the option to "Create a sub-directory for each database" is enabled, and the "Folder" is specified as "\\backupserver\backupshare$\sqlservername$instancename".
The apparent cause of the error is the extra two backslashes at the beginning of the path passed to the xp_create_subdir procedure. The procedure call mentioned in the error message fails with the same error when executed "as is", but succeeds if two backslashes at the beginning of the path are removed (the double backslashes in the middle of the path string do not cause the error).
The actual BACKUP DATABASE statement succeeds, and since the directory already exists on disk, the error is non-critical in this case. It would be more serious if occurred the first time the maintenance plan is run, when the directory actually needs to be created.
The plan works fine most of the time, and the path passed to xp_create_subdir does not contain double backslashes in those cases (as verified with a Profiler trace). To date, the error has happened 10 times since this daily maintenance plan has been created in mid-September of 2007.
This occurs on post-SP2 build 3186.