Hi
I've created a litle backup database script that users that don't have the MS SQL Server Enterprise Manager could use.
The script looks like this
The script is executet from DOS prompt with
The problem with this script is that the backup file will grow bigger and bigger (appends) each time the script is executed. Any tip why?
Some missing argument to the
i guess...
I noticed that I could delete the row
after the first time the script hade executed.
I've created a litle backup database script that users that don't have the MS SQL Server Enterprise Manager could use.
The script looks like this
Code:
DECLARE @dbName varchar(100)
DECLARE @backupFolder varchar(200)
DECLARE @path varchar(250)
DECLARE @db varchar(150)
/***** CHANGE this information to suit your needs *****/
SET @dbName = 'myDatabase'
SET @backupFolder = 'c:\DB_Backup\'
/******************************************************/
SET @db = @dbName + '_bak'
SET @path = @backupFolder + @db + '.dat'
USE master
EXEC sp_addumpdevice 'disk', @db, @path
BACKUP DATABASE @dbName TO @db
The script is executet from DOS prompt with
Code:
osql -U sa -P -i c:\pathToMyScriptFile.sql
The problem with this script is that the backup file will grow bigger and bigger (appends) each time the script is executed. Any tip why?
Some missing argument to the
Code:
BACKUP DATABASE
I noticed that I could delete the row
Code:
EXEC sp_addumpdevice 'disk', @db, @path