Retrieving port number with sql query

31 03 2008


Declare @PortNumber VarChar(7)

Exec Xp_RegRead

@RootKey=’HKEY_LOCAL_MACHINE’,

@Key=’Software\Microsoft\Microsoft Sql Server\SQLEXPRESS\MSSQLServer\SuperSocketNetLib\Tcp’,

@Value_Name=’TcpPort’,

@Value=@PortNumber OutPut

Print ‘Port Number:’

Print @PortNumber

When you execute this you will get a problem to enable XP_CMDshell.You can enable by this.Read the article at:
Enabling xp_cmdshell in SQL Server 2005


Actions

Information

Leave a comment

You can use these tags : <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>