DECLARE @filename VARCHAR(255) DECLARE @date DATETIME SELECT @date=GETDATE() SELECT @filename = 'G:\存放位置\數(shù)據(jù)庫名稱-'+CAST(DATEPART(yyyy,@date) as varchar)+'-'+CAST(DATEPART(mm,@date) as varchar)+'-'+CAST(DATEPART(dd,@date) as varchar)+'.bak' BACKUP DATABASE [數(shù)據(jù)庫名稱] TO DISK = @filename WITH INIT GO