Tuesday, January 24, 2017

Transaction and Commands for SA Account and Password in SQL Server

Transaction and Commands for SA Account and Password in SQL Server


SA account is default administrator for SQL Server. No matter Transaction-SQL or Commands, they provide ways to take operations on SA account and its password. And in this passage, we mainly pay attention to how to verify, change, clear SA password with Transaction and commands.

1. Transaction-SQL for SA password


1-1 Verify SA account and its password:

Select * from my usertable where text=ÕsaÕ and password =Password


1-2 Change SA password:

Exec_password Ôold_passwordÕ, Ônew_passwordÕ, ÔsaÕ


1-3 Clear SA password:

Exec_password NULL, ÔsaÕ


This way asks for SQL Server logon, no matter using Windows Authentication mode or SQL Server Authentication mode. But generally, when we remember SA password to login into SQL Server, we would not like to do these. And if you try to access SQL Server with Windows Authentication mode, but failed, turn to this article to find reasons and solutions if necessary:
Why cannot login into SQL Server with Windows Authentication

2. Commands to change/reset SA password:


Osql ÐE

EXEC sp_password NULL, yourpassword, sa

Go


For more ways to change SA password, turn to article Four Effective Ways to Change SQL Server SA Password.



Related Articles:

  • How to Change SQL Server Login Password
  • How to Reset SQL Server Password without Access
  • Lock and Unlock Record in SQL Server Database

Go to link Download