11

I am getting Windows API Call Error Code : 0

I have installed SSMS 2018 and was trying to find out if I have any other versions installed. For that I ran sqllocaldb versions in CMD but got the following message:

Windows API call "RegGetValueW" returned error code: 0.

When I checked manually (via Control Panel), I saw that I have 2015 and 2016 versions installed. So Why it are they not showing in CMD.

I tried to find other solutions but found nothing that made sense to me.

Trevor Reid
  • 2,533
  • 3
  • 23
  • 33
Ravi
  • 121
  • 1
  • 6
  • 2
    https://feedback.azure.com/forums/908035-sql-server/suggestions/34222855--windows-api-call-reggetvaluew-error-when-displ – GSerg Jun 25 '19 at 19:29

2 Answers2

20

This post helped me: https://social.msdn.microsoft.com/Forums/sqlserver/en-US/1257bf26-6ab0-416d-bf26-34f128f42248/sql-2016-sp1-sqllocaldb-versions-errors-with-quotwindows-api-call-quotreggetvaluewquot?forum=sqlexpress

In registry change catalog name in

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

to match the version listed in

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

I my case I had to change from 13.0 to 13.1.

Kevin Scharnhorst
  • 617
  • 1
  • 6
  • 12
daniell89
  • 1,442
  • 12
  • 23
  • 3
    This also happens with Visual Studio 2019 (for me it's version 16.3.3) with a workload that includes SSDT/localDB. I logged a bug report here: https://developercommunity.visualstudio.com/content/problem/809670/vs-2019-163-that-includes-ssdt-sqllocaldb-command.html – Gen1-1 Nov 06 '19 at 17:40
10

This is still an issue sometimes in 2020. daniell89's answer is correct, here is an image further explaining the fix.

enter image description here

Eric Herlitz
  • 22,490
  • 25
  • 106
  • 149