Friday, March 9, 2012

Getting Network User Names

Can you write a query to get all the network user names?
Thanks
DonDon wrote:
> Can you write a query to get all the network user names?
> Thanks
> Don
Get's them from where? What version of SQL Server? Do you mean those
network users who are currently logged into SQL Server, or do you mean a
query of Active Directory to query all users?
For SQL 2000: You can query the master..sysprocesses table (nt_username
column) for all connected users that have connected using Windows
Authentication. Otherwise, you can use the loginname for SQL
Authentication.
For SQL 2005: You can query the sys.dm_exec_sessions dmv.
David Gugick - SQL Server MVP
Quest Software|||If you want to get list of all the accounts, you can do this
by creating a linked server to Active Directory. See books
online topic:
OLE DB Provider for Microsoft Directory Services
The following article has more information and links:
INFO: Performing a SQL Distributed Query by Using ADSI
http://support.microsoft.com/?id=299410
-Sue
On Sun, 12 Mar 2006 08:46:02 -0800, Don
<Don@.discussions.microsoft.com> wrote:
>Can you write a query to get all the network user names?
>Thanks
>Don

No comments:

Post a Comment