June 25, 2008 at 10:59 pm
Hi,
We have different function within the SQL to get the usrename in SQL. but do we have any function to get the Windows NTUser name in SQL server 2005.
I want to get the system i.e. Windows Login User in SQL server 2005?
Thanks & Regards,
Abhijit
( Database Developer )
June 25, 2008 at 11:30 pm
[font="Verdana"]Hi,
I was not clear.. Do you need the list of logins exists in windows user panel or do you need to windows user name connected to SQL Server?[/font]
Regards..Vidhya Sagar
SQL-Articles
June 26, 2008 at 7:03 am
Thats true i want to know the Windows NT Users (log on name) whoare connected to SQL server we got the machine name from HOST_NAME() functions, but I wan the logon name for that particular host.
June 26, 2008 at 7:17 am
select SPID,
DB_NAME(dbid) as dbname,
dbid,
hostname,
program_name,
loginame from master.dbo.sysprocesses
Order by login_time desc
Or use xp_logininfo 'DOMAIN\USER'
or use xp_logininfo 'DOMAIN\groupname','members' - this will list all the members of the NT group.
Maninder
www.dbanation.com
June 26, 2008 at 7:29 am
Hi,
Just use sp_who2.
If you need more info just cutomize sp_who2 for your needs
Regards
June 26, 2008 at 7:48 am
We get the details using xp_logininfo, sp_who2.. i think i need to explain you the scenario a little bit more...
Okay.. I have Server say 100.100.100.2
Different developers are accessing the server. now my question is how can we see who are accessing the Server.. ( their m/c Login Name )
e.g 10 developers a re in XYZ domain but their NT login is Different.. I'll get their machine name like X1, X2, X3, X4... but i wan to knwo there NT user Name like in X1-XYZ1 is logged in, in X2-XYZ2 is logged in.
June 26, 2008 at 8:12 am
select * from sys.dm_exec_requests
select * from sys.dm_exec_connections
Select * from sys.dm_exec_sessions
These should be your best bet on SQL Server 2005. These DMV's Provide more info than sysprocesses and sp_who2.
Join them to your needs.
Maninder
www.dbanation.com
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply