As we all know tempdb will be recreated everytime when the SQL Server service restarts.
How do we know the timestamp of SQL Server service restarts/tempdb creation through query?
1) Using Dynamic Management View: (Not everyone will have this permission)
SELECT SQLSERVER_START_TIME FROM SYS.DM_OS_SYS_INFO
2) Whoever with Read Access can use the below query.
SELECT CREATE_DATE AS LAST_RESTART_TIME
FROM SYS.DATABASES
WHERE NAME = 'tempdb'
(or)
SELECT CRDATE AS LAST_RESTART_TIME
FROM MASTER.DBO.SYSDATABASES
WHERE NAME = 'tempdb'
How do we know the timestamp of SQL Server service restarts/tempdb creation through query?
1) Using Dynamic Management View: (Not everyone will have this permission)
SELECT SQLSERVER_START_TIME FROM SYS.DM_OS_SYS_INFO
2) Whoever with Read Access can use the below query.
SELECT CREATE_DATE AS LAST_RESTART_TIME
FROM SYS.DATABASES
WHERE NAME = 'tempdb'
(or)
SELECT CRDATE AS LAST_RESTART_TIME
FROM MASTER.DBO.SYSDATABASES
WHERE NAME = 'tempdb'