Situatie
Mai jos este o procedura care returneaza timpul in zile si ore, in care serverul de sql a fost up.
Solutie
alter procedure ServerUpTime
as
declare @data datetime
select @data = crdate from sys.sysdatabases where dbid = 2
declare @NrZile int
declare @NrOre int
select @NrZile = datediff (dd, @data , getdate() )
select @NrOre = datediff ( hh, @data, getdate() )
print ‘UpTimeDays ‘ + convert(varchar(max),@NrZile )
print ‘UpTimeHours ‘+ convert(varchar(max),@NrOre )
Leave A Comment?