January 12, 2011 at 4:35 am
Hi All,
can any one help how to find out the instance name of the server by using reg query?
Help appreciable!!
Thanks.
January 12, 2011 at 4:48 am
SELECT ServerName = @@servername,
InstanceName = CASE WHEN CharIndex('\', @@ServerName) = 0 THEN NULL
ELSE SubString(@@ServerName, CharIndex('\', @@ServerName)+1, 100) END;
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
January 13, 2011 at 11:03 am
if by reg you mean Registery
Exec xp_regenumvalues N'HKEY_LOCAL_MACHINE',
N'SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL';
January 13, 2011 at 12:32 pm
I am fundamentally opposed to going to the registry unless it is ABSOLUTELY necessary.. And in this case it isn't..
SELECT InstanceName = SERVERPROPERTY('InstanceName')
It will return NULL for a default instance..
CEWII
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply