Connecting To A Database Using Windows Authentication With Different Credentials Using SQL Server Management Studio

This info courtesy of inotekgroup and Paulo Morgado:

The problem

You want to use a different username and password to connect to a SQL Server but the Windows Authentcation Username/Password are greyed out / disabled!

When connecting to a SQL Server using Windows Authentication, there is no way to type in an alternate domain/username through the user interface. It will default to the user that you are currently logged into the computer as.

How to Fix it

We’ll have to use the runas command to impersonate the user running SQL Server Management Studio (this comes with SQL Server ).

To connect using an alternate windows domain name, run the following command line script (alter the path to SSMS.EXE based on your computer’s configuration).

runas /netonly /user:[DOMAIN]\[USERNAME] “C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe”

This will open the tool. You can connect to any SQL Server that the user has access to – however, the domain\username that you typed in will not actually appear in the SQL Credential window. Don’t be confused – this will work, even though it doesn’t appear to.

Problems?

if you are on vista or above please run this command from an administrator command prompt

Some commands that you can run using Command Prompt might require elevated or administrative privileges. To run these commands, you can use the Run as administrator command:

  1. Click the Start button 4f6cbd09 148c 4dd8 b1f2 48f232a2fd33 Connecting To A Database Using Windows Authentication With Different Credentials Using SQL Server Management Studio.
  2. In the Search box, type command prompt.
  3. In the list of results, right-click Command Prompt, and then click Run as administrator. 18abb370 ac1e 4b6b b663 e028a75bf05b Connecting To A Database Using Windows Authentication With Different Credentials Using SQL Server Management Studio If you are prompted for an administrator password or confirmation, type the password or provide confirmation.

3 comments to Connecting To A Database Using Windows Authentication With Different Credentials Using SQL Server Management Studio

  • VGR

    Good, This was a simple and clean fix.

    Thanks,
    Vikram

  • Rich

    that runline TOTALLY worked for me.
    Thank you!!

    well done lads,
    Rich

  • gayatri

    Initially it didn’t work for me as I was giving wrong path for Ssms.exe file
    It was located in this path(110) for my pc configuration instead of 100 folder:-
    “C:\Program Files\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\Ssms.exe”
    It worked for me after I modified to point to this location. Thanks! :)

Leave a Reply

  

  

  

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>