I have logged into windows as user ‘abc123’ and then connected to sql server as different user ‘xyz456’,
in this case what would be the connection string ?
I’m unable to connect the usual way and doubt there should be something which I’m missing in my connection string for a different windows user, please share your thoughts guys.
If you are using UserID and Password in Connection string, you are connecting to that Database using SQL Authentication (user created in SQL DB), not your Windows credentials.
If you mention Integrated Security=SSPI;instead of User ID, Password, then you will be able to connect with your Windows Credentials provided you have enabled Windows Authentication (Or Mixed) in the DataBase.
Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=SSPI;
User ID=myDomain\myUsername;Password=myPassword;
I have logged in to machine using with one user and trying to connect the sql with different user with windows authentication. I have ran the below command -
runas /noprofile /netonly /user:domain\username ssms.exe
but still it is using/taking the same user Id by using which I have logged into machine.
Another thing which I have tried is that - I have added a new windows user in windows credentials manager and tried to login into sql with that newly added user but still it is taking the user , by using which we have logged into machine.
Please help