May 20, 2005 at 11:11 am
I know I can look at the event log to see when SQL Server (2000) was last started, and when TEMPDB was created. However, if I wanted to give someone a query to run to PROVE how long SQL Server has been up is this possible ?
May 20, 2005 at 11:17 am
I'll look into a T_SQL query, but I know you can tell this information from the SQL Server logs. In SQL Server Enterprise manager, go into Management, SQL Server Logs, Current Log. At the very top of that file you should see an entry for the SQL Server starting. I think that I've seen scripts that let you query some of the external log files (and Event Logs for that matter) to gather that sort of info.
It should also be in one of the system tables as well, though. I'll see if I can find something.
May 20, 2005 at 11:24 am
Here's one solution (Googled on SQL Server Uptime). Minutes since last reboot:
SELECT datediff(mi, login_time, getdate())
FROM master..sysprocesses WHERE spid = 1
May 20, 2005 at 11:50 am
Thanks for your replies. I took your SQL and modified it a tad and it gives me the date and time it came up... Probably not the cleanest but it does work..
use master
select loginame,login_time from sysprocesses
where loginame = 'sa'
May 21, 2005 at 1:01 am
SELECT MIN(Login_time) from sysprocesses. will give you the most accurate information
Amit Lohia
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply