Sql server up time

Configurare noua (How To)

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 )

Tip solutie

Permanent
Etichetare:

Voteaza

(10 din 20 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?