-
getting environment variable value from SP Code
Hi,
I want to get the value of an environment variable which is set by command prompt of operating system like
start -> run -> cmd
set myname=Mahendra
i want to use this environment variable myname in my Stored procedure of sql server 2005.
Please advise.
Thanks
-
There is no direct way to do that, but you can do this
create table #output (output varchar(255))
insert into #output exec master..xp_cmdshell 'set'
select output from #output where output like '%windir%'
Or
you could use xp_regread procedure to read HKEY_CURRENT_USER key values.
-
Thanks for your quick reply..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|