SQL Server Authentication Method

432 Views Asked by At

I would like to know if it is possible to change a SQL Server authentication account to Windows Authentication?

Why would I want to do this you are asking yourself right now, well I don't want to give out a SQL Server Auth username and password to multiple users to connect to the database, currently the company do things this way, and we don't really have another choice. When we deploy a new database script we don't always have the Windows Auth account before it gets released and we don't want to go an update our deployment script.

I am trying to do this using

ALTER USER Test  
WITH NAME = [mydomianname\username]`

I've tried it but no luck.

I keep getting this error:

Msg 15151, Level 16, State 1, Line 1
Cannot alter the user 'Test', because it does not exist or you do not have permission.

Thank you in advance!

1

There are 1 best solutions below

0
On

I think you should be altering user with login not name, because with name you just rename the user:

ALTER USER Test WITH LOGIN = [mydomianname\username]

But it is impossible because of:

Cannot remap a user of one type to a login of a different type. For example, a SQL user must be mapped to a SQL login; it cannot be remapped to a Windows login.