Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Storing windows login in SQL Server table

Are there any best practices for storing Windows logins in SQL server tables(e.g. AddUser field for an audit table)? I have seen tables using sysname, varchar(255) etc.

p.s. Apologies in advance if this has already been answered. I couldn't find or formulate the right query to look this up.

like image 580
cs31415 Avatar asked Jun 02 '10 20:06

cs31415


People also ask

How do I add Windows Authentication to SQL Server?

Right-click the server you wish to modify and then click Properties. Select the Security Page. Under the Server authentication heading choose either the desired authentication: Windows Authentication or SQL Server and Windows Authentication mode. Click OK.

How do I add a computer login to SQL Server?

Right-click on the Logins node and then click on New Login… In the Login – New window, select the Search… button. It is important to include the dollar $ sign because if you don't, the login name will be treated as a user account and not a computer account.

Can a SQL Server login use Windows Authentication?

There are two possible modes: Windows Authentication mode and mixed mode. Windows Authentication mode enables Windows Authentication and disables SQL Server Authentication. Mixed mode enables both Windows Authentication and SQL Server Authentication. Windows Authentication is always available and cannot be disabled.

How does Windows Authentication work in SQL Server?

Windows authentication uses a series of encrypted messages to authenticate users in SQL Server. When SQL Server logins are used, SQL Server login names and encrypted passwords are passed across the network, which makes them less secure.


2 Answers

Have you considered storing the user SID?

like image 135
jhappoldt Avatar answered Nov 06 '22 14:11

jhappoldt


Does this answer your question: Windows Username maximum length ?

like image 43
jcolebrand Avatar answered Nov 06 '22 12:11

jcolebrand