Sql Server Express Port

se vuoi conoscere quale porta sta usando un istanza di sql server express, usa questo script
CREATE TABLE #GetPort
(
token varchar(100),
value varchar(20))
go DECLARE @inst varchar(200)
DECLARE @inst1 varchar(100)
--Determine registry path and key IF(charindex('\',@@servername) > 0)
BEGIN SELECT @inst = substring(@@servername,charindex('\',@@servername) ,50)
SELECT @inst = 'SOFTWARE\Microsoft\Microsoft SQL Server'+@inst+'\MSSQLServer\SuperSocketNetLib\Tcp' --SELECT @inst1 = 'TcpDynamicPorts' SELECT @inst1 = 'TcpPort' END ELSE BEGIN if SUBSTRING(@@VERSION,23,1) = '7'
begin SELECT @inst = 'SOFTWARE\Microsoft\MSSQLServer\Client\SuperSocketNetLib\VIA' SELECT @inst1 = 'DefaultServerPort' end else begin SELECT @inst = 'SOFTWARE\Microsoft\MSSQLServer\Client\SuperSocketNetLib\Tcp' SELECT @inst1 = 'DefaultPort' end END print @inst + '\\\\////'+ @inst1

INSERT #GetPort
EXEC master..xp_regread 'HKEY_LOCAL_MACHINE', @inst, @inst1

SELECT substring(@@servername,1,25) as ServerName, value as port FROM #GetPort

DROP TABLE #GetPort

posted @ mercoledì 20 aprile 2011 17:07

Print

Comments on this entry:

# eGo-T

Left by eGo-T at 04/04/2012 06:55
Gravatar
Since 2008,the electronic cigarette(e cigarette) line is developing fast,all kinds of
Comments have been closed on this topic.
«novembre»
domlunmarmergiovensab
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011