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
 SSIS and Import/Export (2005)
 Read registry values in Script Task

Author  Topic 

rcdeeley
Starting Member

3 Posts

Posted - 2011-10-12 : 17:38:19
I am wondering if anybody has an example of how to read a value from the registry in a Script Task for the purpose of setting value of a user variable? The SSIS package is being run from the file system and I need to be able to read some values from a key in HKEY_LOCAL_MACHINE, but cannot figure out how to accomplish it.

Thanks,

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-10-13 : 02:26:28
why do you need to do it in script task? you can directly add a configuration to take variable value from registry setting.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

Lumbago
Norsk Yak Master

3271 Posts

Posted - 2011-10-13 : 04:06:00
You can do like this in a sql task instead (or maybe just use the cmd in the script task?):

create table #reg (id int identity(1, 1) not null, regkey_value varchar(2000))
insert into #reg
exec xp_cmdshell 'REG QUERY HKLM\Software\Microsoft\MediaPlayer /v IEInstall'

select regkey_value from #reg where id = 3

drop table #reg


- Lumbago
My blog-> http://thefirstsql.com/2011/07/08/how-to-find-gaps-in-identity-columns-at-the-speed-of-light/
Go to Top of Page
   

- Advertisement -