Database Journal
MS SQL Oracle DB2 Access MySQL PostgreSQL Sybase PHP SQL Etc SQL Scripts & Samples Tips Database Forum

» Database Journal Home
» Database Articles
» Database Tutorials
MS Access
SQL Scripts & Samples
» Database Forum
» Slideshows
» Sitemap
Free Newsletters:

By submitting your information, you agree that databasejournal.com may send you databasejournal offers via email, phone and text message, as well as email offers about other products and services that databasejournal believes may be of interest to you. databasejournal will process your information in accordance with the Quinstreet Privacy Policy.

News Via RSS Feed

Database Journal |DBA Support |SQLCourse |SQLCourse2

Featured Database Articles

Database User and Programming Tips

Posted April 2, 2018


The California Consumer Privacy Act: What You Need to Know

How to Programmatically Identify When Your SQL Server Was Last Started

By Greg Larsen

Where do you go to find the last time SQL Server was started?  I’m guessing you might have gone to the ERRORLOG file and reviewed it to determine when SQL Server started.  That method will work.  But what if you programmatically want to script a way to identify when SQL Server was last started.  How would you do that?

There is a simple TSQL way to programmatically identify the last time SQL Server was started.  Here is the code to accomplish this:

SELECT login_time FROM sys.dm_exec_sessions WHERE session_id = 1;

See all articles by Greg Larsen

Database User and Programming Tips Archives

Comment and Contribute


(Maximum characters: 1200). You have characters left.