﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Discuss content posted by Michael Smith / Article Discussions / Article Discussions by Author  / Server Up-Time Information / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Wed, 22 May 2013 22:29:23 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Server Up-Time Information</title><link>http://www.sqlservercentral.com/Forums/Topic402310-497-1.aspx</link><description>It aslo calculates a start time in the future:server_up_time_min	server_up_time_hr	server_up_time_day	approx_server_start_utc_datetime-26332.06	-438.87	-18.29	2012-01-13 08:47:00HTH -- Mark D Powell --</description><pubDate>Thu, 17 Nov 2011 10:58:18 GMT</pubDate><dc:creator>Mark D Powell</dc:creator></item><item><title>RE: Server Up-Time Information</title><link>http://www.sqlservercentral.com/Forums/Topic402310-497-1.aspx</link><description>The script calculates the uptime for the [i]server[/i], not the database [i]service[/i].</description><pubDate>Mon, 07 Dec 2009 03:27:27 GMT</pubDate><dc:creator>SwePeso</dc:creator></item><item><title>RE: Server Up-Time Information</title><link>http://www.sqlservercentral.com/Forums/Topic402310-497-1.aspx</link><description>There's a much simpler way to do this:select ServerUptimeInHrs = datediff(hh, Login_time, current_timestamp)from sys.dm_exec_sessionswhere session_id = 1That gives you the hours, obviously days, minutes or whatever are just as easy to calculate...</description><pubDate>Fri, 11 Apr 2008 16:02:47 GMT</pubDate><dc:creator>DCPeterson</dc:creator></item><item><title>RE: Server Up-Time Information</title><link>http://www.sqlservercentral.com/Forums/Topic402310-497-1.aspx</link><description>All my installations seems to have negative values in the sample_ms column. Seems to be a bug or an overflow .</description><pubDate>Thu, 15 Nov 2007 08:02:42 GMT</pubDate><dc:creator>Selva Jayakar</dc:creator></item><item><title>RE: Server Up-Time Information</title><link>http://www.sqlservercentral.com/Forums/Topic402310-497-1.aspx</link><description>Nice query!! But the server start time is not coming out correct as you are subtracting all the days, and then all the hours and all the minutes. Just subtracting the total minutes of uptime from the current time should show the right date and time the server was last started.    WITH ServerUpTimeInfo AS (            SELECT  (dm_io_virtual_file_stats.sample_ms / 1000.00 ) / 60.00                        AS server_up_time_min,                    ((dm_io_virtual_file_stats.sample_ms / 1000.00 ) / 60.00) / 60.00                        AS server_up_time_hr,                    (((dm_io_virtual_file_stats.sample_ms / 1000.00 ) / 60.00) / 60.00) / 24.00                        AS server_up_time_day            FROM    sys.dm_io_virtual_file_stats(1,1) AS dm_io_virtual_file_stats )    SELECT  CAST(server_up_time_min AS decimal(12,2)) AS server_up_time_min,            CAST(server_up_time_hr AS decimal(12,2)) AS server_up_time_hr,            CAST(server_up_time_day AS decimal(12,2)) AS server_up_time_day,            CAST(DATEADD(mi,                  -ROUND(server_up_time_min, -1), getutcdate()) as smalldatetime                ) as approx_server_start_utc_datetime    FROM    ServerUpTimeInfo;</description><pubDate>Mon, 05 Nov 2007 15:11:06 GMT</pubDate><dc:creator>rbandyo</dc:creator></item><item><title>Server Up-Time Information</title><link>http://www.sqlservercentral.com/Forums/Topic402310-497-1.aspx</link><description>Comments posted to this topic are about the item [B]&lt;A HREF="/scripts/SQLInsider+Scripts/31994/"&gt;Server Up-Time Information&lt;/A&gt;[/B]</description><pubDate>Mon, 24 Sep 2007 18:22:47 GMT</pubDate><dc:creator>Michael L. Smith</dc:creator></item></channel></rss>