While I'm waiting for my user to get access permissions, I'm stuck using a colleague's, and whenever I try to run basic SQL queries I have to switch from my Windows user to hers.

Hopefully this is clear enough: I want to access a SQL Server for which another user on the same intranet has permissions while I only have her credentials, and that the server utilizes Integrated Security.

  • 2
    Just an opinion: If you have her credentials, then you have some serious security issues at the company you are working for other than unable to start SSMS with a different account or having to wait for the permission to access a database. – hot2use Nov 14 at 12:02
  • 2
    If the SQL authentication is turned off and you need integrated windows authentication then indeed you can only switch the client windows user or use „Run As“ (and you and she are most likely violating company policy by sharing an account) – eckes Nov 14 at 12:09
  • 2
    @hot2use there are too many other issues to rant about, as expected from a company maintaining legacy systems. – Outman Nov 14 at 12:36
up vote 7 down vote accepted

You can open SSMS as her Windows user account by doing either of the following:

  1. Right click the SSMS shortcut while holding the SHIFT key. Click on Open as another user and enter the other users credentials.

  2. Create a shortcut in the following format:

C:\Windows\System32\runas.exe /savecred /user:DOMAIN\USERNAME "C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio\Ssms.exe"

You'll need to replace the path to SSMS.exe with your version.

Once you open the shortcut and enter the password for the account, you can then simply double click the shortcut in the future as it will store your credentials for later use.

  • Thanks a whole lot! I wasn't aware of the runas command, this is going to be much more helpful in the future than just fixing this problem. – Outman Nov 14 at 11:19

There are valid times to runas an application as a domain account other than your own. Based on the OP wording though, this is not one of them. It may be outside the scope of this site, but before using the accepted answer as a workaround to perform your work responsibilities, you need to get approval in writing from your manager, your coworker, her manager - and have at least notified whoever has authority over security policy for your company. Don’t bother defining what the actions you should be taking are, now that you’re impersonating another user - you are approved to perform every action she is approved to perform.

  • 1
    I really appreciate your concern, but I've already gotten permission to temporarily use her account. As to why my question is outside the scope of this site; I used a real world example for the sole purpose of giving more context since abstracting my question would've been a little bit more confusing. But again, much obliged. – Outman Nov 14 at 12:56
  • 1
    @Outman application impersonation isn’t necessarily outside the scope of this site. Rather my answer on behavioral implementation of security policy may not be strictly on-topic. If you have all the approvals (in writing, that bit is important) mentioned above, then full steam ahead - as long as you understand that this approach is an anti-pattern at best and a risk to you personally at worst. – Peter Vandivier Nov 14 at 13:00
  • Just to add to this answer - which I agree with but don't think it necessarily answers the question posited - I only use this as we are a multi-domain site and I often need to open 4-5 SSMS sessions as different domain accounts, all of which are owned by me. – George.Palacios Dec 5 at 12:03

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.