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 ...