Manipulating the Registry
Extended stored procedures are C or C++ routines that let you perform actions outside the scope of standard T-SQL database access and management. You can view SQL Server's available extended stored procedures in the master database. Here are seven undocumented extended stored procedures that you can use to manipulate the registry. Remember that modifying the registry can cause severe system problems, so take extra precautions before performing any action that can alter the registry.
Of the extended stored procedures in this list, only this one is exclusively in SQL Server 2000. To produce a resultset that contains all the subkeys in a specified registry location, enter the following statement in Query Analyzer or as a part of a stored procedure:
This extended stored procedure returns multiple resultsets that list registry values and data.
Xp_regread lets you read the values that subkeys, such as BackupDirectory, contain:
EXEC master.dbo.xp_regread 'HKEY_LOCAL_MACHINE',
4. xp_regaddmultistring or xp_regremovemultistring
Running xp_regaddmultistring, as in the following example, adds a new value to the multivalued string entry. Likewise, xp_regremove-multistring removes one string item at a time.
To delete a specified registry subkey, including all its values and data, enter
To delete a registry value and its data, enter
This vital registry extended procedure writes registry values.