Date and time SQL Server last started - How to...

1. When was the SQL Server Service Started ?
SELECT sqlserver_start_time [SQL Server Started at] FROM sys.dm_os_sys_info

2. When was the TempDB database Re-Created ?
SELECT create_date [Tempdb Re-created at] FROM sys.databases WHERE [name] ='tempdb'

Both the query have some difference on it's Time, Because, The Tempdb database will be Re-created after the SQL Server service started.

So, The first one tells the actual SQL Server start date & time

No comments:

Post a Comment