title: SQL Server - Return the decimal value of a hexadecimal registry value
body: <p>I am trying to retrieve a value from the registry and store its INT value.  The registry entry is DWORD and is in Hexadecimal format, however when retrieving the value using xp_regread it returns the hexadecimal value, and I need this in decimal.....any help?</p>
  
  <p>Reg Key:</p>
  
  <pre><code>[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ShortCuts\General]
  "Appointment Interval"=dword:0000000f
  </code></pre>
  
  <p>The decimal value of the above key should be 15</p>
  
  <p>Code used to return/store the value:</p>
  
  <pre><code>    DECLARE @Interval INT
  
  DECLARE @temp_table TABLE (Value nvarchar(500), Data nvarchar(500))
  INSERT INTO @temp_table EXEC master.sys.xp_regread 'HKEY_LOCAL_MACHINE', 'SOFTWARE\Wow6432Node\Shortcuts\General', 'Appointment Interval'
  SELECT @Interval = Data FROM @temp_table
  </code></pre>
  
  <p>Returning the variable @Interval currently returns 5</p>