SET LANGUAGE BRAZILIAN

declare @arquivoBKP varchar(200)
declare @data varchar(20)
declare @base smallint
declare @nomebase varchar(20)
declare @nomebkp varchar(20)

set @base = 1

set @data = '_'+Left(DATENAME(DW, GETDATE()),3)
set @data = @data+'_'+ cast(DATEPART(HOUR, GETDATE()) as varchar(2))+'h'

while @base <= 3
begin
  Set @nomebase =
    case @base when 1 then 'RSYS2003'
      WHEN 2 then 'dbRSYSNFE'
     when 3 then 'rsys2003log'
    END 

  Set @arquivoBKP = 'C:\Backup_Rsys2003\'+@nomebase+@data+'.bak'
  Set @nomebkp = @nomebase + '-Full'
 

  BACKUP DATABASE @nomebase TO DISK = @arquivobkp
  WITH NOFORMAT, INIT,  NAME = @nomebkp, SKIP, NOREWIND, NOUNLOAD,  STATS = 10
 
  set @base = @base + 1
 
end