USE [HIS_DB]
GO
/****** Object: StoredProcedure [dbo].[Proc_BackUpDataBase] Script Date: 11/25/2017 15:03:47 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: 刘
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
create PROCEDURE [dbo].[Proc_BackUpDataBase]
@FilePath VARCHAR(100) ,
@DbName VARCHAR(50)
AS
DECLARE @BackupSql NVARCHAR(200)
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON ;
SET @FilePath = ' ''' + @FilePath + @DbName
+ REPLACE(CONVERT(VARCHAR(20), GETDATE(), 20), ':', '') + '.bak'''
SET @BackupSql = ' Backup Database ' + @DbName + ' To disk='
+ @FilePath
EXECUTE sp_executesql @BackupSql
END
GO