May 12, 2011 at 6:56 am
i m using SQL 2008 and i just want to know ,,How i will take a database backup datewise in a same folder.
I did using job scheduling but database file .bak is append or overwrite..
And i want database should be backup in a single folder with the name and date...
If some one knw ..pls help me
May 12, 2011 at 7:02 am
I generally use an SSIS package with the following to generate the back-up queries: -
SELECT
'BACKUP DATABASE [' + name + '] TO [' + name + '] WITH ' + CASE WHEN Datepart(dw, Getdate()) <> 2
THEN 'DIFFERENTIAL,'
ELSE '' END + ' NOFORMAT, NOINIT, NAME = N''' +
name + '-' + CASE WHEN Datepart(dw, Getdate()) <> 2
THEN 'Differential'
ELSE 'Full' END + ' Database Backup' + CONVERT(VARCHAR(12), Getdate(), 102) + ''', SKIP, NOREWIND, NOUNLOAD, STATS = 10'
FROM MASTER..sysdatabases
Then a ForEach loop that executes each query.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply