Finding the CD Key

Can I find an installed SQL Server's CD key from the Windows registry? I have the software, but I've misplaced the key.

See also, "Transferring SQL Server Registration Information Between Machines" and "Manipulating the Registry."

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:

\Microsoft\Microsoft SQL Server

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
                'SOFTWARE\Microsoft\Microsoft SQL

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.

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.