Sunday, February 19, 2012

Backup a database

Hello
I am trying to backup a database, on daily basis.
I wrote script like this:
DECLARE @.mypath = 'C:\Program Files\Microsoft SQL
Server\MSSQL\Backup\ProjectServer' + DATE
BACKUP DATABASE [ProjectServer] TO DISK = @.mypath WITH INIT , NOUNLOAD ,
NAME = N'ProjectServer backup', NOSKIP , STATS = 10, NOFORMAT
It "passed" the "apply" key, but the backup itself failed.
Please advice.It always helps to include the actual error message so we know what we are
dealing with. But I will assume it has to do with your concatenation of the
DATE. You might want to try this instead:
CONVERT(NVARCHAR(16),GETDATE(),112)
Andrew J. Kelly SQL MVP
"Elijah Bass" <elijah.bass@.horizonsemi.com> wrote in message
news:eF1J2$GQGHA.3872@.TK2MSFTNGP15.phx.gbl...
> Hello
> I am trying to backup a database, on daily basis.
> I wrote script like this:
> DECLARE @.mypath = 'C:\Program Files\Microsoft SQL
> Server\MSSQL\Backup\ProjectServer' + DATE
> BACKUP DATABASE [ProjectServer] TO DISK = @.mypath WITH INIT , NOUNLOAD
> , NAME = N'ProjectServer backup', NOSKIP , STATS = 10, NOFORMAT
> It "passed" the "apply" key, but the backup itself failed.
> Please advice.
>|||thank you!
it works
the error was very simple: backup couldnt start:)
"Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
news:%23rh4BmHQGHA.312@.TK2MSFTNGP12.phx.gbl...
> It always helps to include the actual error message so we know what we are
> dealing with. But I will assume it has to do with your concatenation of
> the DATE. You might want to try this instead:
> CONVERT(NVARCHAR(16),GETDATE(),112)
>
> --
> Andrew J. Kelly SQL MVP
>
> "Elijah Bass" <elijah.bass@.horizonsemi.com> wrote in message
> news:eF1J2$GQGHA.3872@.TK2MSFTNGP15.phx.gbl...
>

No comments:

Post a Comment