Записи по mssql,oracle,windows и linux

Have a Question?

If you have any question you can ask below or enter what you are looking for!

Время работы MSSQL

DECLARE @Days  int
DECLARE @Hours int
DECLARE @Mins  int
DECLARE @Secs  int
DECLARE @getdate datetime
DECLARE @getdateunix int
set @getdate = getdate()
set @getdateunix = DATEDIFF(s, '1970-01-01 00:00:00', GETUTCDATE())
SET @Secs = (
		SELECT datediff(ss, login_time, getdate())
		FROM master..sysprocesses 
		WHERE spid = 1
SET @Days  = ((@Secs/60)/60)/24
SET @Hours = ((@Secs/60)/60)%24
SET @Mins  = (@Secs/60)%60
SET @Secs  = @Secs%60
select @@servername as servername,@getdate as createdate,@getdateunix as createdate_unix ,@Days as days,@Hours as hours,@Mins as mins ,@Secs as secs


Leave a Reply

Your email address will not be published. Required fields are marked *

You can use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>