Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 registry

Author  Topic 

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2008-07-11 : 04:55:25
Hi,
In sql server configurations, named pipes (NP) is disabled and shared memory (SM) is enabled.
using t-sql I am trying to find out whether or not they are enabled. See below...

Problem:
For NP, the returned field shows empty whereas it shows 'r' for SM

Question:
1)
Does 'r' represent enabled and blank field represents Disabled?

2)
The code at the very buttom shows disabled for both returned data. Can you see why please?

--code to get NP:

--Named Pipes...
Declare @valueNP as varchar(100)

Set @valueNP = NULL

Exec master..xp_regread 'HKEY_LOCAL_MACHINE', 'SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\MSSQLServer\SuperSocketNetLib\Np', 'Enabled', @valueNP OUTPUT

select @valueNP

--code to get SM:
--Shared Memory...
Declare @valueSM as varchar(100)

Set @valueSM = NULL

Exec master..xp_regread 'HKEY_LOCAL_MACHINE', 'SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\MSSQLServer\SuperSocketNetLib\Sm', 'Enabled', @valueSM OUTPUT

select @valueSM

--------------
if (len(ltrim(rtrim(@valueNP))) > 0)
select 'Enabled'
else
select 'Disabled'

if (len(ltrim(rtrim(@valueSM))) > 0)
select 'Enabled'
else
select 'Disabled'

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2008-07-11 : 23:57:45
If enabled, the key is 1. Otherwise, it's 0.
Go to Top of Page

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2008-07-14 : 05:38:08
How do I modify the sql I am using so that I get 1 or 0?
Thanks
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-07-14 : 05:48:11
Declare @valueNP as INT
Declare @valueSM as INT



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2008-07-14 : 05:52:37
Thanks
Go to Top of Page
   

- Advertisement -