Underlying SQL Server database backup stored procedures
/******************************************************************************************************** function: Native BACKUP Database * * danny,li** Date: 2012-11-05**----------------------------------------------------------------------------------- ----------------* * eg:exec [proc_localbackupdb] ' DataBaseName ', ' C:\DatabaseBackup ' * * ***************************** **************************************************************************/CREATE PROCEDURE [dbo].[proc_localbackupdb] @databaseName varchar( -),--the name of the database that needs to be backed up @folderPath varchar( -)--backup file storage address asBEGIN DECLARE @sqlStr VARCHAR( +),@backupFile VARCHAR( -); --backing up the database SET @backupFile = @databaseName + CONVERT(VARCHAR( -),GETDATE(), A)+ '. BAK'; SET @sqlStr = 'BACKUP DATABASE'+ @databaseName +'to DISK =" "+@folderPath+'\'+@backupFile+" "With INIT'; --Execute SQL statement PRINT(@sqlStr); EXEC(@sqlStr);END
SQL Server database backup (native)