This script comes handy when you would like to find out the Server and SQL services restart times.
DECLARE @SQLServiceRestartDateTime AS VARCHAR(50),
@ServerRestartDateTime AS VARCHAR(50)
SELECT @SQLServiceRestartDateTime = create_date FROM sys.databases WHERE database_id=2
SELECT @ServerRestartDateTime = CAST(DATEADD(SECOND, (ms_ticks/1000) * -1, GETDATE()) AS datetime) FROM sys.dm_os_sys_info
SELECT @SQLServiceRestartDateTime AS [SQL Service Start DateTime], @ServerRestartDateTime AS [Server Start DateTime]
No comments:
Post a Comment