In procedure create folder for each database and backup of the
database should get saved in that folder.
For e.g : If your database name is 'Test' then in procedure create
folder 'test' and store backup of test database in test folder. Then
for database 'AdventureWorks' create folder called 'AdventureWorks'
and store backup in that folder.
Mohit
SET @.CommandString = 'IF NOT EXIST "' + @.LocalBackupPath + '\' + @.name +
'" MD "' + @.LocalBackupPath + '\' + @.name + '"'
EXEC xp_cmdshell @.CommandString
SET @.SQL = 'BACKUP DATABASE [' + @.name + '] TO DISK = N''' +
@.LocalBackupPath + '\' + @.name + '\' + @.name + CONVERT(VARCHAR, GETDATE(),
112) + '.bak'' WITH INIT, NOUNLOAD, NAME = N''' + @.name + ' backup'', SKIP,
STATS = 10, NOFORMAT'
EXEC(@.SQL)
"mohit" <goenka.mohit@.gmail.com> wrote in message
news:69386449-4e88-44f4-9081-455ab5e32941@.k2g2000hse.googlegroups.com...
> In procedure create folder for each database and backup of the
> database should get saved in that folder.
>
> For e.g : If your database name is 'Test' then in procedure create
> folder 'test' and store backup of test database in test folder. Then
> for database 'AdventureWorks' create folder called 'AdventureWorks'
> and store backup in that folder.
sql
No comments:
Post a Comment