Getting my Server details from Registry

  • When I use SQL Server Management Studio it tells me that my "Server" is "MEDESKTOP\GARY", which is the name of my PC & my UserID ... where does SSMS get this from ?

    I searched the Registry and have found this value in the Registry under the Key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\LoggedOnSAMUser" ... but not knowing much about how the Registry works I don't know if this is a temporary key or the correct place to pick this up, either on my PC or others that my Application is deployed to.

    My PC is running Vista & is stand-alone, there is no Server involved, and the PCs that this is likely to be deployed to will be running WinXP & Windows 7, also stand-alone ... BUT ... in the future this may not be the case, so any help is appreciated ...

  • MEDESKTOP\GARY is what is known as your "instance name". The fact that your username is also Gary is only a coincidence. Instance names are chosen when installing SQL Server.

    On my lowly XP workstation I see a list of the installed SQL Server instances here:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • I have used that key to ascertain instances of SQL Server installed on the PC, mine just says "SQLEXPRESS" & "MSSQL10_50.SQLEXPRESS" as the Value Data. Maybe I am getting ahead of myself, the "String" in my program will presumably only need the "SQLEXPRESS" part & the Database itself, when installed onto the other PCs will, presumably, be owned by the user on that PC, so I may not need this info ?!?

    Sorry, maybe I am asking questions that are irrelevant, I never really expected to have to write my own Application to deploy my program and it's Database onto another PC ... Thanks for replying though ...

    opc.three (3/22/2012)


    MEDESKTOP\GARY is what is known as your "instance name". The fact that your username is also Gary is only a coincidence. Instance names are chosen when installing SQL Server.

    On my lowly XP workstation I see a list of the installed SQL Server instances here:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL

  • gary.p.heath (3/22/2012)


    I have used that key to ascertain instances of SQL Server installed on the PC, mine just says "SQLEXPRESS" & "MSSQL10_50.SQLEXPRESS" as the Value Data. Maybe I am getting ahead of myself, the "String" in my program will presumably only need the "SQLEXPRESS" part & the Database itself, when installed onto the other PCs will, presumably, be owned by the user on that PC, so I may not need this info ?!?

    Sorry, maybe I am asking questions that are irrelevant, I never really expected to have to write my own Application to deploy my program and it's Database onto another PC ... Thanks for replying though ...

    opc.three (3/22/2012)


    MEDESKTOP\GARY is what is known as your "instance name". The fact that your username is also Gary is only a coincidence. Instance names are chosen when installing SQL Server.

    On my lowly XP workstation I see a list of the installed SQL Server instances here:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL

    The key provided will house the instance names for all instances installed on your machine (same in Win7).

    Are you looking under registered servers? It is quite possible that the name you are seeing is an alias or is the name used to identify this particular instance when you created a "registered server" within SSMS.

    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

  • SQLRNNR is pointing out a non-standard scenario where you may have an SQL Native Client alias setup, or have a Registered Server setup with a name other than your instance name. Now that we know your real instance name we can plan for that.

    gary.p.heath (3/22/2012)


    I have used that key to ascertain instances of SQL Server installed on the PC, mine just says "SQLEXPRESS" & "MSSQL10_50.SQLEXPRESS" as the Value Data.

    It appears you have one SQL Express instance installed on your machine and it is named as SQLEXPRESS, which I think this is the default-name for a SQL Express installation.

    Maybe I am getting ahead of myself, the "String" in my program will presumably only need the "SQLEXPRESS" part & the Database itself, when installed onto the other PCs will, presumably, be owned by the user on that PC, so I may not need this info ?!?

    With a machine name of MEDESKTOP then you would reference the instance as MEDESKTOP\SQLEXPRESS in your application's config file. Optionally you can use .\SQLEXPRESS which could make your config file generic provided all your client installations have the same defaulted name for their SQL Express instance of SQLEXPRESS. Know that you will need to provide the machine name and instance name though as <machine_name>\<instance_name>, i.e. just SQLEXPRESS will not suffice. The dot (.) in .\SQLEXPRESS is a shortcut for "local machine". Microsoft makes the same assumption and uses this in the canned ASP.NET config files they distribute in demos and distributable installs, so it is perfectly acceptable to use it in yours.

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

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

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