retrieve computer

  • Is it possible to retrieve the name of the computer where an instance of ss2k exists?

    thanks in advance,

    Billy

  • select @@servername from query analyzer

    Steve

  •  

    -- Computername on which SQL server is running

    SELECT 'MachineName: ' + CONVERT(char(20), SERVERPROPERTY( 'MachineName' ) )

    -- Servername and Instance name of SQL Server

    SELECT 'ServerName: ' + CONVERT(char(20), SERVERPROPERTY( 'Servername' ) )

    /rockmoose


    You must unlearn what You have learnt

  • One other way to get the machine name...

    I use it to see which node has the load in clusters.

    DECLARE @test-2 varchar(20)

    EXEC master.dbo.xp_regread

    'HKEY_LOCAL_MACHINE', 

    'SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName',  

    'ComputerName',

    @test-2 OUTPUT

    select 'The active node is ' + @test-2

  • Impressive!  The people on this site never ceases to amaze me!

    Billy

     

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

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