Delete from Registry using SQL | SansSQL

Wednesday, July 16, 2008

Delete from Registry using SQL

xp_regdeletekey and xp_regdeletevalue are the two undocumented stored procedures that helps in deleting values and keys from registry. These stored procedures should be used very vary carefully as there are chances of harming the system and system may crash.

xp_regdeletekey
This is an extended stored procedure that will delete an entire key from the registry.
EXEC xp_regdeletekey @rootkey,@key
Example:-
EXEC master..xp_regdeletekey @rootkey='HKEY_LOCAL_MACHINE',
@key='SOFTWARE\Test'

xp_regdeletevalue

This is an extended stored procedure that will delete a particular value for a key in the registry.

EXEC xp_regdeletevalue @rootkey,@key,@value_name

Example:-

EXEC master..xp_regdeletevalue @rootkey='HKEY_LOCAL_MACHINE', @key='SOFTWARE\Test', @value_name='TestValue'

No comments:

Post a Comment