We sometimes need to run sql server management studio as another user or switch to a different windows user in development environment to test our scripts with different user rights and for many other reasons. But the way how the windows authentication works is it will simply grab the account information of the current user and pass it to SQL Server and we don’t really have much option on SQL Server Management Studio (SSMS) to change a different windows user.
Let us see how we could get around this in action:
Right now I am logged in to HomeServer as bNigatu and my objective is to use a different windows authentication user without going out and logged in to the development machine as a Different User. I have an account named JasonNigatu that is a member of db_datareader role.
Step 1: Open command prompt and type
runas /user:[WindowsUserName] SSMS.exe |
Replace [WindowsUserName] with an actual windows user name.
Step 2: When you press enter it will ask you to enter password and type the password for the user name on Step1.
After you type and press enter SSMS will start with the account on Step 1
Finally click on connect and you will have a new SQL Server instance with JasonNigatu while I am loged in to the machine as BizNigtu.