代码如下: DECLARE @filename VARCHAR(255) DECLARE @date DATETIME SELECT @date=GETDATE() SELECT @filename = ‘G:\存放位置\数据库名称-‘+CAST(DATEPART(yyyy,@date) as varchar)+’-‘+CAST(DATEPART(mm,@date) as varchar)+’-‘+CAST(DATEPART(dd,@date) as varchar)+’.bak’ BACKUP DATABASE [数据库名称] TO DISK = @filename WITH INIT GO