views:

107

answers:

1

I need to create a directory for sql server backups. I have to dynamically place the backup file in different folders on many different sql server installs. The backup fails if the directory doesn't exist. So if I can create the directory in a stored procedure or some other call before I call the backup command that would be helpful. Any ideas?

Thanks

+5  A: 

Try

declare @Path varchar(100)
set @Path = 'c:\CreatedFromSQL'
EXEC master.dbo.xp_create_subdir @Path

Sourced from http://www.mssqltips.com/tip.asp?tip=1460

Tetraneutron
That's perfect thanks. I can't vote you up or I would.
Mosquito Mike
You mark it as the selected answer by clicking the "Tick" below the Vote counter in my answer.
Tetraneutron