is there any Unique Identification of Sql Server & Sql Server Database

  • Hi there,

    My scenario is , I want to check that whether two connection strings are equal or not?; specified on some connection form (c#, vb, vb.net ...).

    Is there some unique identification (number or some guid) of server name and database name ?, As there is multiple types of methods by which a server name can be specified.(.,local,servername,ipaddress,.\instancename etc).

    Any way ?

  • You'd have to be able to query the network to determine this. At any time, only one Windows name is allowed on the network, so that's unique, but you can assign multiple IPs to a server, and you can connect by IP. You could connect through a named pipe, but that would have the server name in it, though you would have to query the actual instance to determine if it was the same as some other instance.

    Actually, that might be the best way. Connect to the server, select @@servername and compare.

    What are you trying to accomplish here?

  • Yes, this is what I was required select @@ServerName,

    I had to compair to two connection string in .net(c#) , if those are same then I should continue for the further process, otherwise the program should exit.

    I have tried your method and it is working sucessfully for me. Thank you for the reply.

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

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