By using sp_who2 I can get a list of current log-in users and machine names. Some users are using SQL Server log-in user name such as sa. Is there any way I can get the windows log-in user name for the SQL log-in users?
If there is no way to get Windows log-in users from the machine names, can I use WMI class or C# to get find out the Windows log-in user names by their machine names?
My SQL server is Microsoft SQL Server 2005 and Windows is Server 2003.
SQL Server USER_NAME() Function The USER_NAME() function returns the database user name based on the specified id. If no id is specified, this function will return the name of the current user.
In Object Explorer, expand the SQL Server, expand Security, right-click Logins, and then select New Login. For the Login name, enter the Windows user name in the domain\username format. When using this adapter with BizTalkBizTalkMicrosoft BizTalk Server allows connecting diverse software, then graphically creating and modifying process logic that uses that software. BizTalk Server also enables information workers to monitor running processes, interact with trading partners, and perform other business-oriented tasks.https://learn.microsoft.com › core › introducing-biztalk-serverIntroducing BizTalk Server - Microsoft Learn, then the login name you enter, is the identity of the host instance account.
So for example, to show MySQL users' username, password and host, we'll modify the sql query to accordingly as such: mysql> select user, password, host from mysql. user; The above sql query will present you with a list of users and their respective user name, password and database host.
SQL Server supports two authentication modes, Windows authentication mode and mixed mode. Windows authentication is the default, and is often referred to as integrated security because this SQL Server security model is tightly integrated with Windows.
To get the user and machine name use this:
SELECT HOST_NAME() AS HostName, SUSER_NAME() LoggedInUser
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With