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
3,2304 gold badges26 silver badges46 bronze badges
asked Jun 25, 2019 at 19:16
1
This is still an issue sometimes in 2020. daniell89’s answer is correct, here is an image further explaining the fix.
answered Apr 24, 2020 at 7:23
Eric HerlitzEric Herlitz
25.2k27 gold badges113 silver badges157 bronze badges
0
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_MACHINESOFTWAREMicrosoftMicrosoft SQL ServerMSSQL13E.LOCALDB MSSQLServerCurrentVersion
In my case it was 13.1.4001.0
Then go to Local DB registry:
HKEY_LOCAL_MACHINESOFTWAREMicrosoftMicrosoft SQL Server Local DBInstalled 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.
answered Mar 9, 2022 at 14:59
- Remove From My Forums
-
Question
-
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.
HKLMSOFTWAREMicrosoftMicrosoft SQL Server Local DBInstalled Versions13.1
I loaded regedit and confirmed the path does not exist. The registry does have
HKLMSOFTWAREMicrosoftMicrosoft SQL Server Local DBInstalled Versions13.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.
Answers
-
I got this on my machine, the problem was that under this registry key:
HKEY_LOCAL_MACHINESOFTWAREMicrosoftMicrosoft SQL ServerMSSQL13E.LOCALDBMSSQLServerCurrentVersion
There is an «CurrentVersion» value that is «13.1.4001.0» and under:
HKEY_LOCAL_MACHINESOFTWAREMicrosoftMicrosoft SQL Server Local DBInstalled 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.
SSDT Dev Pack — Open source (free) Visual Studio Add-in: -Extract select statements into TVF’s -Create stub tSQLt tests -Change keyword casing -Name constraints -Ui for Merge statements https://the.agilesql.club/Projects/SSDT-Dev-Pack
-
Proposed as answer by
Wednesday, March 29, 2017 8:59 AM
-
Marked as answer by
.MARK
Sunday, April 30, 2017 5:48 PM
-
Proposed as answer by
The «RegGetValueW» error in SQL Server is a registry error that occurs when the Windows API call «RegGetValueW» returns a value of 0, indicating a failure. This error can occur for several reasons, including a corrupted registry, incorrect permissions, or missing registry keys. Solving the error requires understanding the root cause and implementing a solution to correct it. In this article, we will provide a list of possible methods to resolve the «RegGetValueW» error in SQL Server.
Method 1: Repair the Registry
If you encounter the «Windows API call «RegGetValueW» returned error code: 0″ error in SQL Server, you can try repairing the registry to fix it. Here are the steps:
-
Press the Windows key + R to open the Run dialog box.
-
Type «regedit» and press Enter to open the Registry Editor.
-
Navigate to the following key:
HKEY_LOCAL_MACHINESOFTWAREMicrosoftMicrosoft SQL Server
-
Right-click on the «Microsoft SQL Server» folder and select «Export» to create a backup of the registry key.
-
Save the backup file to a safe location.
-
Delete the «Microsoft SQL Server» folder from the registry.
-
Restart the SQL Server service.
Here is a sample code:
@echo off
regedit /e C:backup.reg "HKEY_LOCAL_MACHINESOFTWAREMicrosoftMicrosoft SQL Server"
reg delete "HKEY_LOCAL_MACHINESOFTWAREMicrosoftMicrosoft SQL Server" /f
net stop MSSQLSERVER
net start MSSQLSERVER
This code creates a backup of the «Microsoft SQL Server» registry key, deletes the key, stops and starts the SQL Server service.
Note: Be careful when making changes to the registry. Back up the registry before making any changes.
Method 2: Grant the Correct Permissions
To fix the «Windows API call «RegGetValueW» returned error code: 0″ error in SQL Server, you can grant the correct permissions to the registry key.
Here are the steps to do it:
-
Open the Registry Editor by typing «regedit» in the Start menu search box and pressing Enter.
-
Navigate to the following registry key:
HKEY_LOCAL_MACHINESOFTWAREMicrosoftMicrosoft SQL Server
-
Right-click on the «Microsoft SQL Server» key and select «Permissions».
-
Click the «Add» button, enter the name of the user or group that needs access to the key, and click «OK».
-
Select the user or group from the list, and then check the «Full Control» box under the «Allow» column.
-
Click «OK» to save the changes.
Here is an example of how to grant permissions to the registry key using PowerShell:
$registryKey = "HKLM:SOFTWAREMicrosoftMicrosoft SQL Server"
$user = "DOMAINUSERNAME"
$permission = "FullControl"
$rule = New-Object System.Security.AccessControl.RegistryAccessRule($user,$permission,"Allow")
$acl = Get-Acl $registryKey
$acl.SetAccessRule($rule)
Set-Acl $registryKey $acl
This PowerShell script grants full control to the specified user on the «Microsoft SQL Server» key.
Another way to grant permissions to the registry key is to use the «regini» utility. Here is an example:
HKEY_LOCAL_MACHINESOFTWAREMicrosoftMicrosoft SQL Server [1 5 7 11]
This command grants full control to the «Administrators» group and the «SQLServerMSSQLUser$» group on the «Microsoft SQL Server» key.
By granting the correct permissions to the registry key, you should be able to resolve the «Windows API call «RegGetValueW» returned error code: 0″ error in SQL Server.
Method 3: Check and Re-install the .NET Framework
If you encounter the error message «Windows API call RegGetValueW returned error code: 0» in SQL Server, it may be caused by a corrupted or missing .NET Framework installation. In this case, you can try to fix the issue by checking and re-installing the .NET Framework. Here are the steps:
- Check the current .NET Framework version installed on your system. You can do this by opening the Command Prompt and running the following command:
reg query "HKLMSOFTWAREMicrosoftNET Framework SetupNDPv4Full" /v version
-
If the output shows that the .NET Framework version is not installed or is corrupted, you can download and install the latest version of .NET Framework from the Microsoft website.
-
After installation, verify that the .NET Framework is installed correctly by running the following command in the Command Prompt:
reg query "HKLMSOFTWAREMicrosoftNET Framework SetupNDPv4Full" /v version
- If the output shows the correct version of .NET Framework, restart the SQL Server service and check if the issue is resolved.
Here’s an example PowerShell script that checks the .NET Framework version and installs the latest version if it’s missing or corrupted:
$frameworkVersion = (Get-ItemProperty 'HKLM:SOFTWAREMicrosoftNET Framework SetupNDPv4Full').version
if ($frameworkVersion -lt '4.8') {
Write-Host "Installing .NET Framework 4.8..."
$webClient = New-Object System.Net.WebClient
$url = "https://download.visualstudio.microsoft.com/download/pr/014120d7-eb06-4d8e-9d1a-5f5c710f49d3/5e3f7cf834d1f03f5b5f2b5d2dfb9fc2/ndp48-x86-x64-allos-enu.exe"
$path = "C:Tempndp48-x86-x64-allos-enu.exe"
$webClient.DownloadFile($url, $path)
Start-Process $path -ArgumentList "/q /norestart" -Wait
Write-Host "Installation complete."
}
This script checks if the .NET Framework version is less than 4.8 and downloads and installs the latest version if necessary. Note that this script requires administrative privileges to run.
In conclusion, checking and re-installing the .NET Framework can help fix the «Windows API call RegGetValueW returned error code: 0» issue in SQL Server. Make sure to verify the installation and restart the SQL Server service after installation.
Method 4: Use the Microsoft Support and Recovery Assistant
If you are facing the error message «Windows API call «RegGetValueW» returned error code: 0″ in SQL Server, you can use the Microsoft Support and Recovery Assistant to fix it. Here are the steps to do it:
-
Download and install the Microsoft Support and Recovery Assistant from the official website.
-
Open the Microsoft Support and Recovery Assistant and select «SQL Server» from the list of products.
-
Select the issue «Windows API call «RegGetValueW» returned error code: 0″.
-
Follow the on-screen instructions to diagnose and fix the issue. The assistant will automatically detect and fix any problems with the registry keys that are causing the error.
Here is an example code snippet that shows how to use the Microsoft Support and Recovery Assistant to fix the issue:
EXEC msdb.dbo.rds_download_and_install_support
@download_url = 'https://aka.ms/sdra-download',
@installer_path = 'C:tempSDRA.exe';
Note: The above code is just an example and may not work in your environment. Please refer to the official documentation for more information.
That’s it! By using the Microsoft Support and Recovery Assistant, you can easily fix the «Windows API call «RegGetValueW» returned error code: 0″ issue in SQL Server.
Method 5: Restore the System to a Previous Restore Point
To fix the «Windows API call «RegGetValueW» returned error code: 0″ issue in SQL Server, you can restore the system to a previous restore point. Here are the steps to do so:
-
Open the System Properties window by right-clicking on «This PC» and selecting «Properties», or by pressing the Windows key + Pause/Break.
-
Click on «System Protection» in the left-hand menu.
-
Click on the «System Restore» button.
-
Select a restore point from the list of available restore points. Make sure to choose a restore point that was created before the error started occurring.
-
Click «Next» and then «Finish».
-
Confirm that you want to restore your system by clicking «Yes».
-
Wait for the restore process to complete. This may take several minutes.
Once the restore process is complete, your system should be restored to the state it was in at the time of the selected restore point. This should resolve the «Windows API call «RegGetValueW» returned error code: 0″ issue in SQL Server.
Note: Restoring your system to a previous restore point may cause some of your installed programs or settings to be lost. Make sure to back up any important data before proceeding with this method.
1. Open the System Properties window by right-clicking on "This PC" and selecting "Properties", or by pressing the Windows key + Pause/Break.
2. Click on "System Protection" in the left-hand menu.
3. Click on the "System Restore" button.
4. Select a restore point from the list of available restore points. Make sure to choose a restore point that was created before the error started occurring.
5. Click "Next" and then "Finish".
6. Confirm that you want to restore your system by clicking "Yes".
7. Wait for the restore process to complete. This may take several minutes.
I am very very new to database systems. You could say I have no idea what I am doing. But I have been hired for an internship that requires I learn.
To this purpose I installed SMSS 17.9 and somehow Microsoft SQL server 2017 but it didn’t install SQLlocaldb. I also have VS 2019 and 2017 and for some reason, these also didn’t install SQLlocaldb.
Therefore I installed SQLLocaldb by itself by after downloading SQLServer2017-SSEI and opting to download files to run later: https://learn.microsoft.com/en-us/sql/database-engine/configure-windows/sql-server-express-localdb?view=sql-server-ver15
Anyways, I found a tutorial on youtube and as the man is starting, he runs
«sqllocaldb versions». For him it shows his SQL server versions. For me I get:
«Windows API call «RegGetValueW» returned error code: 0″
So I googled to find solutions to this. Most of them have to do with changing registry version values as shown here:
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
Windows API call «RegGetValueW» returned error code: 0
However for me I have this issue where there is no version key in my registry:
Why don’t I see a version for my LocalDB?
The solution was to go to the version key and change it to match with the version of SQLServer like in this example:
Windows API вызов «RegGetValueW» возвращенный код ошибки: 0
Я получаю Windows API код ошибки вызова : 0
Я установил SSMS 2018 и пытался выяснить, установлены ли у меня какие-либо другие версии. Для этого я запустил sqllocaldb versions
в CMD, но получил следующее сообщение:
Windows API вызов «RegGetValueW» вернул код ошибки: 0.
Когда я проверил вручную (через Панель управления), я увидел, что у меня установлены версии 2015 и 2016 годов. Так почему же они не показываются в CMD году?
Я пытался найти другие решения, но не нашел ничего, что имело бы для меня смысл.
2 ответа
- YouTube AS3 Player API код ошибки 0
В последнее время я получаю много кода ошибки 0, используя AS3 Player API. Я решил отделить свое приложение от ванильного плеера, чтобы убедиться, что ошибка не была вызвана моим приложением. Для этого я построил автономный образец AS3PlayerShim в Flex, следуя инструкциям из…
- Пользовательское действие LsaAddAccountRights возвращает код ошибки в Windows Server 2012
У меня есть пользовательское действие, которое используется для повышения уровня пользователей, чтобы они могли войти в систему как служба. Это запускается во время установки. Он прекрасно работает в течение многих лет на каждой операционной системе Windows вплоть до Windows Server 2012. Когда…
Этот пост мне очень помог: 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?форум= отчеты
В реестре измените имя каталога в
в соответствии с версией in
В моем случае мне пришлось сменить 13.0 на 13.1.
Это все еще остается проблемой иногда в 2020 году. ответ daniell89 правильный, вот изображение, дополнительно объясняющее исправление.
Похожие вопросы:
Я пытаюсь создать программу с использованием Windows сокетов и получаю код ошибки 0 при попытке создать сокет int iResult = WSAStartup(MAKEWORD(2, 2), &wsaData); if (iResult != NO_ERROR) {…
Я пытаюсь проверить, не подделан ли мой пакет Metro style каким-либо образом, проверяя наличие всех файлов в пакете. Если какой-либо файл отсутствует, я устанавливаю состояние пакета на…
Возможный Дубликат : Facebook API ошибка 191 API Код Ошибки: 191 API описание ошибки: указанный URL не принадлежит приложению Сообщение об ошибке: redirect_uri не принадлежит приложению. — Что…
В последнее время я получаю много кода ошибки 0, используя AS3 Player API. Я решил отделить свое приложение от ванильного плеера, чтобы убедиться, что ошибка не была вызвана моим приложением. Для…
У меня есть пользовательское действие, которое используется для повышения уровня пользователей, чтобы они могли войти в систему как служба. Это запускается во время установки. Он прекрасно работает…
Я получаю код ошибки API: 1383008 ,когда пытаюсь открыть диалог оплаты Facebook в приложении canvas, Я проверил, что мой обратный вызов URL работает в тестировании, Что я должен сделать, чтобы…
Итак, я получаю код ошибки 400 с keyInvalid причиной: json = { error = { code = 400; errors = ( { domain = usageLimits; message = Bad Request; reason = keyInvalid; } ); message = Bad Request; }; } Я…
Я установил службу концентратора сообщений Bluemix, а затем добавил соединитель сообщений, чтобы получить потоковую передачу с Twitter. После этого я получил REST API url, чтобы потреблять поток…
Я делаю вызов API на Insightly API, используя этот код: var x = new XMLHttpRequest(); x.open(GET,…
Я установил SQL Server 2012 локальную БД из этой загрузки выбирая ENUx64SqlLocalDB.MSI Я запустил его OK, затем попытался использовать команду sqllocaldb , но получил эту ошибку: PS…