• subscribe
May 20, 2003 12:00 AM

Finding the CD Key

SQL Server Pro
InstantDoc ID #38759

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.



ARTICLE TOOLS

Comments
    There are no comments to display. Be the first one!
You must log on before posting a comment.

Are you a new visitor? Register Here
  • SP1?
    I know there is a SP1 for SQL 2008 R2 available....and there is a "feature pack" as well... ...
  • SQL database mirroring
    I have SQL Server 2008 R2 Enterprise 64bit on Windows 2008 R2 Enterprise 64bit.  Each SQL Server has...
  • Dell Compellent Disk Drive
    Does anybody has experience with Dell Compellent Disk Drive? Basically, this system manages all disk...
  • Sql server performance tuning
    I need to find a tool that help me to optimize sql server,queries,improve the performance and solve ...