Follow along with the video below to see how to install our site as a web app on your home screen.
Примечание: This feature may not be available in some browsers.
-- MSSQL Backup Script
DECLARE @path1 varchar(128)
DECLARE @DBName AS nvarchar(4000)
SET @DBName = 'dbname' -- имя БД
DECLARE @File1 AS nvarchar(4000)
-- сюда будут ложиться бекапы
SET @path1 = 'F:\Backup\'
DECLARE @todaysdate datetime
DECLARE @date varchar
SET @todaysdate = getdate()
DECLARE @FileName AS nvarchar(4000)
SET @FileName = @DBName + '_' + 'backup_' +
CASE DAY(CURRENT_TIMESTAMP)
WHEN 1 THEN '01' WHEN 2 THEN '02' WHEN 3 THEN '03'
WHEN 4 THEN '04' WHEN 5 THEN '05' WHEN 6 THEN '06'
WHEN 7 THEN '07' WHEN 8 THEN '08' WHEN 9 THEN '09'
ELSE CONVERT(nvarchar(2),DAY(CURRENT_TIMESTAMP), 112 ) END + '_' +
CASE MONTH(CURRENT_TIMESTAMP)
WHEN 1 THEN '01' WHEN 2 THEN '02' WHEN 3 THEN '03'
WHEN 4 THEN '04' WHEN 5 THEN '05' WHEN 6 THEN '06'
WHEN 7 THEN '07' WHEN 8 THEN '08' WHEN 9 THEN '09'
ELSE CONVERT(nvarchar(2),MONTH(CURRENT_TIMESTAMP), 112 ) END
+ '_' + CONVERT(nvarchar(4),YEAR(CURRENT_TIMESTAMP), 112 ) + '_' + REPLACE(convert(varchar(12), @todaysdate, 108), ':','-');
-- Добавляем к пути и имени файла идентификаторы и расширения
SELECT @File1 = @path1 + @FileName + '.bak'
-- Запускаем резервное копирование
BACKUP DATABASE @DBName TO DISK = @File1 WITH NOFORMAT, NOINIT, SKIP, REWIND, NOUNLOAD