Version Recognition Issue - egnomerator/misc GitHub Wiki

SQL Server Express LocalDb Installed Version Recognition Issue

sqlserver-e-localdb-version-recognition-issue

The above screenshot shows what happened when I called the sqllocaldb versions command 3 times while troubleshooting a version recognition issue with SQL Server Express 2016 LocalDB.

  • After I first discovered the red underlined error, I uninstalled localdb 2016 to see if the error would occur still
  • the first call in the above screenshot is after uninstalling localdb 2016
    • the the error did not occur after removing 2016
  • Repro: then I reinstalled version 2016 and called versions the second time, seeing the error come back
  • then I looked up the error and discovered this Registry fix (detailed below)
    • based on this forum thread, it seems that the issue is related to recognizing the service pack version
  • after implementing that fix, the third versions call shows that all versions are retrieved successfully

The Registry Fix Details

MSDN source

In case the above source link breaks in the future

  • This is the initial question title and question:

    SQL 2016 sp1 SQLLocalDB versions errors with "Windows API call "RegGetValueW" returned error code: 0."

    I have SQL LocalDB 2016 sp1 installed and when I execute at the command line "SQLLocalDB versions" I get the following error "Windows API call "RegGetValueW" returned error code: 0."

    I used sysinternals procmon.exe to capture any errors accessing the registry.

    The following path was not found that seems significant.

    HKLM\SOFTWARE\Microsoft\Microsoft SQL Server Local DB\Installed Versions\13.1

    I loaded regedit and confirmed the path does not exist. The registry does have

    HKLM\SOFTWARE\Microsoft\Microsoft SQL Server Local DB\Installed Versions\13.0

    SQL LocalDB installed with Visual Studio 2017 which is not SP1 runs without errors.

    I have tried installing service packs for SQL, uninstalling/reinstalling. I have reset windows 2 times. In this final test I installed Windows 10 from scratch and installed only SQL Express Advanced with Sp1. All Windows updates are installed.

    I can't resolve this issue with reinstall or installing the updates.

    I do not find any hits in google for this error. The error is on a clean install of Windows 10.

    Thanks.

    Wednesday, March 22, 2017 8:37 PM

  • And, this is the response marked as the answer and that fixed the issue for me

    I got this on my machine, the problem was that under this registry key:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL13E.LOCALDB\MSSQLServer\CurrentVersion

    There is an "CurrentVersion" value that is "13.1.4001.0" and under:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server Local DB\Installed Versions

    I had "13.0" - changing it to "13.1" fixed the error - not sure why the installed versions wasn't changed when it went to 13.1.

    Probably uninstalling/re-installing would fix it as well.

  • A note on the answer
    • the answer includes a comment at the end:

      Probably uninstalling/re-installing would fix it as well.

    • Before bothering to lookup a fix for the issue, my first troubleshooting step was to uninstall and then reinstall SQL Server 2016, and this did not fix the issue
    • The issue was immediately fixed after the registry edit
⚠️ **GitHub.com Fallback** ⚠️