Home All Groups Group Topic Archive Search About

Bin Location SQL Server 2005

Author
17 Aug 2006 2:00 PM
dkisting
Hello,

I have a script which copies the xp_smtp dll to the bin folder of sql.  In
SQL 2000, I use the procedure or statement EXECUTE sp_MSget_setup_paths
@SQLPath OUT to get the location (c:\program files...) to the bin folder.
However, this doesn't appear to work in SQL 2005.  Is there an equivilent?  I
need to in T-SQL find out the path of the current instance's binn folder.

Thanks!

Author
17 Aug 2006 2:49 PM
Immy
is this of any help?

declare @rc int,

@dir nvarchar(4000)

exec @rc = master.dbo.xp_instance_regread N'HKEY_LOCAL_MACHINE',N'Software\Microsoft\MSSQLServer\MSSQLServer',N'DefaultData', @dir output, 'no_output'

if (@dir is null)

begin

exec @rc = master.dbo.xp_instance_regread N'HKEY_LOCAL_MACHINE',N'Software\Microsoft\MSSQLServer\Setup',N'SQLDataRoot', @dir output, 'no_output'

select @dir = @dir + N'\Data'

select @dir

end



Immy

Show quote
"dkisting" <u25415@uwe> wrote in message news:64e7f1f8eb360@uwe...
> Hello,
>
> I have a script which copies the xp_smtp dll to the bin folder of sql.  In
> SQL 2000, I use the procedure or statement EXECUTE sp_MSget_setup_paths
> @SQLPath OUT to get the location (c:\program files...) to the bin folder.
> However, this doesn't appear to work in SQL 2005.  Is there an equivilent?  I
> need to in T-SQL find out the path of the current instance's binn folder.
>
> Thanks!
>
Author
17 Aug 2006 3:39 PM
dkisting
This works perfectly:

declare @rc int,

@dir nvarchar(4000)

exec @rc = master.dbo.xp_instance_regread N'HKEY_LOCAL_MACHINE',N'Software\
Microsoft\MSSQLServer\MSSQLServer',N'DefaultData', @dir output, 'no_output'



exec @rc = master.dbo.xp_instance_regread N'HKEY_LOCAL_MACHINE',N'Software\
Microsoft\MSSQLServer\Setup',N'SQLDataRoot', @dir output, 'no_output'

select @dir = @dir + N'\Binn'

select @dir

====================
THANKS!!!!

Immy wrote:
Show quote
>is this of any help?
>
>declare @rc int,
>
>@dir nvarchar(4000)
>
>exec @rc = master.dbo.xp_instance_regread N'HKEY_LOCAL_MACHINE',N'Software\Microsoft\MSSQLServer\MSSQLServer',N'DefaultData', @dir output, 'no_output'
>
>if (@dir is null)
>
>begin
>
>exec @rc = master.dbo.xp_instance_regread N'HKEY_LOCAL_MACHINE',N'Software\Microsoft\MSSQLServer\Setup',N'SQLDataRoot', @dir output, 'no_output'
>
>select @dir = @dir + N'\Data'
>
>select @dir
>
>end
>
>Immy
>
>> Hello,
>>
>[quoted text clipped - 5 lines]
>>
>> Thanks!

AddThis Social Bookmark Button