'Windows API call "RegGetValueW" returned error code: 0
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.
Solution 1:[1]
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.
Solution 2:[2]
This is still an issue sometimes in 2020. daniell89's answer is correct, here is an image further explaining the fix.
Solution 3:[3]
I see that the answers above are correct. However, I would like to share how to fix it step by step.
First, open the Registry Editor. To do it make a combination on the keyboard: Windows + R and then type regedit and hit OK. The Registry Editor should appear.
Then find the installed current version under this path:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL13E.LOCALDB \MSSQLServer\CurrentVersion
In my case it was 13.1.4001.0
Then go to Local DB registry:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server Local DB\Installed Versions
There you should have listed folders named as versions.
I had there a folder 13.0 which I have changed to 13.1.
After the renamed of the folder the command SQLLocalDB versions works perfectly.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Kevin Scharnhorst |
| Solution 2 | Eric Herlitz |
| Solution 3 | Krzysztof Juszcze |

