Change SA Login Password Using SQL Query

This query is useful in scenarios where you might forget the password of SA login. In such scenarios this could become of much help instead of uninstalling the product itself.

Open SQL Server Management Studio. Open a new Query. Write the following script.

  1. GO  
  2. ALTER LOGIN [sa] WITH DEFAULT_DATABASE=[master]  
  3. GO  
  4. USE [master]  
  5. GO  
  6. ALTER LOGIN [sa] WITH PASSWORD=N'YourNewPassword' MUST_CHANGE  
  7. GO  
Here replace ‘YourNewPassword’ with the actual password that you wish to mantain. Execute the script and the password gets changed without any trouble.