Get SQLServer Name and Uptime SPROC

  • Chris Gillham

    SSC Rookie

    Points: 25

    Comments posted to this topic are about the item Get SQLServer Name and Uptime SPROC

  • nigel.

    SSChampion

    Points: 11620

    Alternatively:

    SELECT TOP 1 login_time FROM master..sysprocesses (NOLOCK)

    ORDER BY login_time

    Since I've noticed that on some of our SQL servers spid 1 is not the longest running process!

    How, I don't know! Maybe someone more knowledgeable can explain

  • Chris Gillham

    SSC Rookie

    Points: 25

    Thanks for the update, Nigel. I will update the SPROC code.

    Chris

  • MiguelSQL

    Hall of Fame

    Points: 3079

    There are many ways to skin a cat:

    This is my way:

    select crdate,[Name] from sys.sysdatabases where name = 'tempdb'

    Why does this work?

    Well... every time you MSSQL Starts, it recreates the TEMPDB.

    🙂

    Miguel

  • nigel.

    SSChampion

    Points: 11620

    MiguelSQL (11/16/2010)


    There are many ways to skin a cat:

    Indeed there are 🙂

    This is my way:

    select crdate,[Name] from sys.sysdatabases where name = 'tempdb'

    Why does this work?

    Well... every time you MSSQL Starts, it recreates the TEMPDB.

    🙂

    Miguel

    And it looks like like the tempdb is created even sooner than the first process (at least it is on the couple of instances I tried). YMMV

  • akljfhnlaflkj

    SSC Guru

    Points: 76202

    Thanks for the script Chris.

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply