Friday, April 30, 2010

When was your server last restarted?

Since Tempdb gets recreated every time the server is restarted, all you need to know is when was tempdb created -
SELECT create_date
FROM  sysdatabases
WHERE database_id = 2;
Another way -
SELECT sqlserver_start_time
FROM sys.dm_os_sys_info