@@ServerName shows different value

  • Experts,

    Select @@Servername is showing 'GEBPC\GEBPC'

    where as the default sql instance shows 'GEBPC'

    how can this happen?

    please add your best intelligent guess here.

    this created an issue while creating a linked server from another server.

  • Select @@Servername shows the instance you are connected to, not the default instance.



    Alvin Ramard
    Memphis PASS Chapter[/url]

    All my SSC forum answers come with a money back guarantee. If you didn't like the answer then I'll gladly refund what you paid for it.

    For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]

  • I am connected to GEBPC

    but @@servername shows

    GEBPC\GEBPC

    when I connect first time , I use GEBPC only for the windows authentication.

  • Servername\instancename


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • that I know , please understand my question first:)

    Servername\instanceName

    if you look at the database server after you connect to GEBPC, you see GEBPC,

    not GEBPC\GEBPC.

    then I thought this is a default instance.

    HOWEVER , @@servername shows GEBPC\GEBPC , WHY?

    if it was an instance it should have shown like 'GEBPC\GEBPC'.

    moreover I should have connected to GEBPC\GEBPC

    or like

    http://www.codecandle.com/img/codecandle.img.topic101.r.bmssql2008.c2.SSMS.04.sql_instance.jpg

  • daniarchitect (2/19/2015)


    Experts,

    Select @@Servername is showing 'GEBPC\GEBPC'

    where as the default sql instance shows 'GEBPC'

    how can this happen?

    please add your best intelligent guess here.

    this created an issue while creating a linked server from another server.

    So, if I have this correct, you connect to GEBPC but when you run SELECT @@Servername it shows GEBPC\GEBPC?

    Do you have an alias configured?

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

  • Two possibilities here:

    1) The instance is GEBPC\GEBPC and it listens on port 1433. When you connect to GEBPC, you connect to the instance GEBPC\GEBPC. Or, as Perry says, a SQL Client alias is present.

    2) The instance name is wrong. Can happen sometimes, when you rename a computer with a SQL Server instance installed (or mess with sys.servers). Usually, the old computer name remains and doesn't change the instance name, but there's a remote possibility that you're facing this issue. Just to be sure, what does SERVERPROPERTY('ServerName') return? Same as @@SERVERNAME? If not, you may need to re-register your server. Details on how to do it can be found here: http://stackoverflow.com/questions/20992396/getting-wrong-server-name

    -- Gianluca Sartori

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

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