Hi mariam zein,
Thank you for posting in the Microsoft Community Forums.
Open Service Manager: Click “Start” menu, type “services.msc” and press Enter to open Service Manager.
Stop SQL Server services: In the service list, find all the services starting with “SQL” (such as SQL Server (MSSQLSERVER), SQL Server Agent, etc.), right-click them one by one and select “Stop”. Stop”.
Uninstall SQL Server software
Open Control Panel: Click “Start” menu, select “Control Panel”.
Enter the program uninstallation interface: In the control panel, select “Programs” under the “Uninstall a program”.
Uninstall SQL Server: In the program list, find the relevant items of Microsoft SQL Server (may include the main program, client components, etc.), right-click them and select “Uninstall/Change”. Follow the prompts to complete the uninstallation process, make sure you choose to delete all instances and configuration files.
Delete Installation Files and Folders
Delete the installation directory: Usually SQL Server is installed in “C:\Program Files” or “C:\Program Files (x86)” directory. Locate and delete the “Microsoft SQL Server” folder and all its subfolders.
Delete the User Data folder: If SQL Server is configured with a user database, these database files may be stored in a default location (e.g., “C:\ProgramData\Microsoft\MSSQLSERVER\DATA”) or another customized location. Locate and delete these files (be careful to back up important data).
Delete other related folders: It may also be necessary to delete files in directories such as “C:\Users<User Name>\AppData\Roaming\Microsoft” and “C:\Users<User Name>\AppData\Local\Microsoft”. Microsoft” and other directories to delete the folder related to SQL Server.
Fourth, clean up the registry
Open Registry Editor: Press “Win+R”, type “regedit” and press Enter to open Registry Editor.
Delete SQL Server registry entries: In the registry editor, navigate to the following location and delete the relevant entries:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager, delete the PendingFileRenameOperations value (if present).
HKEY_CURRENT_USER\Software\Microsoft\Microsoft SQL Server, delete the entire Microsoft SQL Server key.
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server, delete all SQL Server related sub entries.
Note: Before deleting the registry entries, please make sure to backup the registry in case of any errors that may cause the system to become unstable.
Restart your computer
After completing the above steps, restart your computer to ensure that all changes take effect.
Caution
Before uninstalling and deleting files, please make sure you have backed up all important data and configuration files.
If you encounter any problems during the uninstallation process (e.g. files cannot be deleted, services cannot be stopped, etc.), please try to run the relevant program as administrator or use a system restore point to restore to the state before uninstallation.
If you are uninstalling SQL Server in a corporate environment, make sure that you follow your organization's IT policies and procedures.
Best regards
Neuvi Jiang