Pour automatiser un backup :
declare
@filename varchar(255),
@heure char(2),
@min char(2),
@date char(8)
set @date=convert(char(8),getdate(),112)
set @heure=datepart(hh,getdate())
set @min=datepart(mi,getdate())
if @heure<=9
set @heure=’0’+@heure
if @min<=9
set @min =’0’+@minset @filename=’G:BACKUPmabase_tran_’+@date+’_’+@heure+’h’+@min+’.trn’
backup log mabase to @filename
go