Query to get Instance names in SQL 2000

  • Hi Any Query to get instances running on a machine for SQL 2000

    I was using the following Script but its not working for SQL 2000 can some one guide me here thanks in advance

    CREATE TABLE #GetInstances

    (Value VARCHAR(30), InstanceNames VARCHAR(20), Data VARCHAR(30))

    INSERT INTO #GetInstances

    EXECUTE xp_regread

    @rootkey = 'HKEY_LOCAL_MACHINE',

    @key = 'SOFTWARE\Microsoft\Microsoft SQL Server',

    @value_name = 'InstalledInstances'

    SELECT CAST(serverproperty('ComputerNamePhysicalNetBIOS')AS VARCHAR(20)) AS ServerName,

    CASE

    WHEN InstanceNames = 'MSSQLSERVER'

    THEN CAST(serverproperty('ComputerNamePhysicalNetBIOS') AS VARCHAR(20))

    ELSE CAST(CAST(serverproperty('ComputerNamePhysicalNetBIOS') AS VARCHAR(20))+'\'+ InstanceNames AS VARCHAR(20))

    END AS InstanceName from #GetInstances

  • RamSteve (4/6/2011)


    Hi Any Query to get instances running on a machine for SQL 2000

    I was using the following Script but its not working for SQL 2000 can some one guide me here thanks in advance

    SELECT CAST(serverproperty('ComputerNamePhysicalNetBIOS')AS VARCHAR(20)) AS ServerName,

    CASE

    WHEN InstanceNames = 'MSSQLSERVER'

    THEN CAST(serverproperty('ComputerNamePhysicalNetBIOS') AS VARCHAR(20))

    ELSE CAST(CAST(serverproperty('ComputerNamePhysicalNetBIOS') AS VARCHAR(20))+'\'+ InstanceNames AS VARCHAR(20))

    END AS InstanceName from #GetInstances

    'ComputerNamePhysicalNetBIOS' is not supported in SQL 2000.

    Try using machinename instead.

    http://msdn.microsoft.com/en-us/library/aa259183(v=sql.80).aspx

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • Thank you its working 🙂

  • Excellent

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

Viewing 4 posts - 1 through 3 (of 3 total)

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