none
How to get Host name and SQL Instance Name by T-SQL RRS feed

  • Question

  • I am using SQL 2000, 2005 and 2008. I have few multi instances SQL servers. I would like to gather following information:

    Host Name

    SQL Instance Name

    SQL Version

    Server1

    Server1

    SQL 2000

    Server1

    Server1\ABC

    SQL 2005

    Server1

    Server1\XYZ

    SQL 2008

    Server2

    Server2

    SQL 2008

    Is there any way I can get it by T-SQL? Any help would be appreciated.

    Thanks

    Saumen 

    Thursday, June 14, 2012 11:50 PM

Answers

  • SELECT
                SERVERPROPERTY('MachineName') AS [ServerName], 
    			SERVERPROPERTY('ServerName') AS [ServerInstanceName], 
                SERVERPROPERTY('InstanceName') AS [Instance], 
                SERVERPROPERTY('Edition') AS [Edition],
                SERVERPROPERTY('ProductVersion') AS [ProductVersion], 
    			Left(@@Version, Charindex('-', @@version) - 2) As VersionName


    View Steven Wang's profile on LinkedIn | Blog: MSBICOE.com | MCITP - BI, SQL Developer & DBA

    Hate to mislead others, if I'm wrong slap me. Thanks!

    • Proposed as answer by Syed Qazafi Anjum Friday, June 15, 2012 12:06 AM
    • Marked as answer by XYZ001 Friday, June 15, 2012 12:08 AM
    Friday, June 15, 2012 12:03 AM

All replies