Do you have a comment or suggestion to improve SQL Server? We’d love to hear it!

'Windows API call "RegGetValueW"' error when displaying version in SQLLocalDB Utility 2016 and newer

When using the "v" switch for the SQLLOCALDB command-line utility, it can only display versions 2012 and 2014. Starting with SQL Server 2016, the utility can no longer display installed versions of SQL Server Express LocalDB.

In a command prompt, if I run the following:

C:\>sqllocaldb v

It returns the following (and I have versions 2012, 2014, 2016, and 2017 installed, running on Windows 10 Home Edition):

Microsoft SQL Server 2012 (11.0.7462.6)
Microsoft SQL Server 2014 (12.0.5214.6)
Windows API call "RegGetValueW" returned error code: 0.

The SQL Server 2017 version of SQLLOCALDB.EXE is being used, as indicated by the first few lines of output when not passing in any command-line switches, as shown here:


Microsoft (R) SQL Server Express LocalDB Command Line Tool
Version 14.0.3025.34
Copyright (c) Microsoft Corporation. All rights reserved.

3 votes
Sign in
Password icon
Signed in as (Sign out)

We’ll send you updates on this idea

Solomon Rutzky shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →


Sign in
Password icon
Signed in as (Sign out)
  • Solomon Rutzky commented  ·   ·  Flag as inappropriate

    Thanks Brendon.

    I just checked again and this appears to have been fixed in a recent update. Versions 13.0.5026.0 and 14.0.3045.24 both report the full list of installed versions without any errors, and without me having to edit the registry to change 13.0 to 13.1 under InstalledVersions. I now get back the following:

    Microsoft SQL Server 2012 (11.0.7462.6)
    Microsoft SQL Server 2014 (12.0.6024.0)
    Microsoft SQL Server 2016 (13.0.5026.0)
    Microsoft SQL Server 2017 (14.0.3045.24)

    Of course, version 13.0.5026.0 (i.e. SQL Server 2016) is now broken in other ways (ways that it was not broken before). It cannot display the help info, error messages, or even output from using the "i {instance_name}" option. I guess I will open a separate bug for that :-(.

  • Brendon Thiede commented  ·   ·  Flag as inappropriate

    I have noticed the same issue even when upgrading from version 13.0 to 13.1. The issue disappears if you modify the registry (found this out here: Specifically, I have to go to:
    HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server Local DB\Installed Versions
    And make sure that only one entry exists and that it is for the current version. Here is PowerShell that I use for the situation moving from 13.0 to 13.1:

    $LocalDBVersion = (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL13E.LOCALDB\MSSQLServer\CurrentVersion").CurrentVersion
    $InstalledLocalDBVersionsPath = "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server Local DB\Installed Versions"
    if ($LocalDBVersion -like "13.1.*" -and -not (Test-Path "$InstalledLocalDBVersionsPath\13.1") -and (Test-Path "$InstalledLocalDBVersionsPath\13.0")) {
    Move-Item "$InstalledLocalDBVersionsPath\13.0" "$InstalledLocalDBVersionsPath\13.1"

Feedback and Knowledge Base