This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Last Boot / Report Writer

I am creating a report with the last boot time of servers.  Would also like to add a column which shows that the time since the last boot.  It's a bit of redundancy here, but will make the customer happy.  One column shows a reboot of 31 Oct 08 at 08:00AM.  I'd like the next column to show how many days/hours since that last reboot. 


 SolarWinds says that this is an advanced SQL report that needs to be done.  I'm a network guy and not a DBA. Any guys out there with some possible help on this?


Here's what I currently have:


SELECT  TOP 10000 Nodes.IP_Address AS IP_Address,
Nodes.LastBoot AS Last_Boot


FROM
Nodes



WHERE 
(
  (Nodes.Vendor = 'Microsoft')
)


 


ORDER BY 1 ASC

  •  What about:

    SELECT  TOP 10000 Nodes.IP_Address AS IP_Address, Nodes.LastBoot AS Last_Boot, DATEDIFF(day, Nodes.LastBoot, getdate()) AS no_of_days

    FROM Nodes

    WHERE (  (Nodes.Vendor = 'Microsoft') )

    ORDER BY 1 ASC
     

    or:

    SELECT  TOP 10000 Nodes.IP_Address AS IP_Address, Nodes.LastBoot AS Last_Boot, DATEDIFF(hour, Nodes.LastBoot, getdate()) AS no_of_hours

    FROM Nodes

    WHERE (  (Nodes.Vendor = 'Microsoft') )

    ORDER BY 1 ASC

     

    For more information about the DATEDIFF command:  doc.ddart.net/.../da-db_6.htm

    HTH,

    Yann
     



     

  • Thanks,


     That gave me exactly what I needed.  Will use the day version versus hours.  Thanks again.


     


    Ryan