1st Everyday wealth building Portal to Products and Services for the Future    

 Home 

   

T-SQL Query SQL Server Start Time

Use T-SQL to Query SQL Server Boot Time:

This query will help you determine the list time the SQL Server started.

Overview:
I manage hundreds of SQL Server 2000 and SQL Server 2005 instances for my clients.  The other day I made an auditing modification, and needed to know when the SQL Servers I had modified had been last restarted.

I'm guessing this is stored somewhere in SQL Server system catalog in the master or msdb database, but, as usual,  I was pressed for time, and really needed to get the answer fast. 

The then "A-Ha!" moment happened.  Every time a SQL Server 2000 or SQL Server 2005 is started, or restarted,  the Tempdb is recreated,  which means that it's create date is a record of the last time SQL Server is started .  Simple right ?

Here is the code:

select crdate from master..sysdatabases where name='tempdb';

The Field crdate is a datetime field.

This Query will work on:
SQL Server 6.5
SQL Server 7
SQL Server 2000
SQL Server 2005

 
 
  eBusiness Links:
Business Opportunities:

  Database Consulting:
Stephen Bergkamp Resume
 
  Information:
Articles 
Data Base
Unix Tips and Tricks
Window Tips and Tricks
Content, Content, Content
DSAFutures Blog
 
  Other Stuff
About DSAFutures
 
--Free STUFF--
Fun Stuff
Links 

Contact Us:
 
     
   
   

 

Search DSA Futures in a new window.

 
   

Top of Page
(c) Copyright 2006 DSA Futures. All Rights Reserved.
Last updated 12/06/2006