Can I find an installed SQL Server's CD key from the Windows registry? I have the software, but I've misplaced the key.
Specific paths to registry keys vary based on how you've installed and upgraded SQL Server. In my registry, the CD key is at the following registry path:
HKEY_LOCAL_MACHINE\SOFTWARE \Microsoft\Microsoft SQL Server \80\registration\CD_KEY
On your machine, the CD key should be in the same registry key or one similar to it.
Alternatively, you could use the undocumented xp_regread extended stored procedure and read the value directly, as this example syntax shows:
USE master EXEC xp_regread 'HKEY_LOCAL_MACHINE', 'SOFTWARE\Microsoft\Microsoft SQL Server\80\registration', 'CD_KEY'
The first parameter specifies the root key in the registry. The second parameter is the path to the key. The third parameter specifies the key value that you're looking for. Note that you should be wary of using xp_regread in an application because it's an undocumented function that Microsoft can remove without warning. However, using the extended stored procedure for ad hoc access is perfectly safe.