Question: I am logged onto my desktop with my primary Active Directory ID. I need to log onto a SQL Server with SQL Server Management Studio (SSMS) with another Active Directory ID - the alternative ID has valid SQL Server security privileges on the target SQL Server.
How can I log onto the target SQL Server with the alternative login , remain on my desktop and use the alternative Active Directory ID ?
Answer: In an earlier post - How to start SSMS as Administrator , there is reference to the RUNAS command. Combining the RUNAS with the the SSMS command line execute will get the result you need.
Open the Command Prompt window & use similar to the below examples
--example 1 : the full path to SSMS RUNAS /user:mydomain\myaltID "C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE\Ssms.exe" --example 2 : using ssms shortcut RUNAS /user:mydomain\myaltID ssms
Once the SSMS is open , you can use some commands to confirm the current login.Returns the name of the login that connected to the instance of SQL Server.
SELECT ORIGINAL_LOGIN();