How do you programmatically find out when the SQL Server service started?

Discussion in 'Databases' started by sscheral, Jul 24, 2008.

  1. #1
    How do you programmatically find out when the SQL Server service started?


    Answer:-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.

    :)
     
    sscheral, Jul 24, 2008 IP