hi,
I want to know how to programmatically find out when the sql server service started?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Kunal NaikPosted Apr 6, 2012, 2:06 AM
There is one simple but awkward method is there to find out when the SQL server service is started.
The following query will give you the time when the SQL server service is started;
select crdate from [master].dbo.sysdatabases
where name='tempdb'
This is because, the tempdb will be created whenever SQL server service is started or restarted.
SELECT login_time FROM sys.dm_exec_sessions WHERE session_id = 1
will give you a
datetimefor when the server was started.Hope this will helps you.