SQL QueriesSQL Tips

To check – How long has your SQL Server has been running since the last SQL Server startup?

By 09/02/2023 December 3rd, 2024 No Comments

To get the information about how long has your server been running since the last SQL Server startup?

 

Code:
SELECT @@Servername AS ServerName ,
create_date AS ServerStarted ,
DATEDIFF(s, create_date, GETDATE()) / 86400.0 AS DaysRunning ,
DATEDIFF(s, create_date, GETDATE()) AS SecondsRunnig
FROM sys.databases
WHERE name = 'tempdb';
GO,

Snippet:


If you are Hire A SQL Developer in Brisbane, Technology Cue is here. Contact us.

Leave a Reply