SQL Connection String - Windows different user

Hi @vvaidya @aksh1yadav @akhi_s27 @Vikas.Jain @badita @beesheep,

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.

Server=myServerName\myInstanceName;Database=myDataBase;User Id=myUsername;

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;

More Info : https://www.connectionstrings.com/sql-server/

didn’t really worked. Tried all these options from google before posting here…


I was thinking SQL User, if this is a different Windows User, I doubt you can do that. Actually never tried.

yea, that’s what I’m after now. Tricky but that’s a requirement. pls see the screenshot below…

If I dont use the “Integrated Security=True”, then it really tries using the other user, but still it doesn’t goes through as shown below,

really appreciate if someone could share thier ideas/thoughts to resolve this…

Guys, any luck with this query ? Really appreciable. Thanks.!


Anyone had any luck with this?