March 22, 2004 at 7:14 am
Is it possible to get the windows domain name for all users in a database? The sysusers table holds only the sql user name. Can I somehow use the SID to get the LAN name?
March 22, 2004 at 7:52 am
Check the logins with
SELECT name
FROM master.dbo.syslogins
WHERE IsNTName = 1
March 22, 2004 at 7:59 am
Thanks, but the name could be anything I type in when adding the user and is not the actual windows login name. I need the latter....
March 23, 2004 at 1:18 am
Good morning folks,
Maybe someone will have an idea for me today!
For example, could I somehow use the SID in the sysusers table to find out the domain name (without using OA_ procedures)?
TIA
March 23, 2004 at 9:21 am
Hi,
Maybe using suser_sname(), and formatting result:
select
name as sql_user,
suser_sname(sid) as login,
left( suser_sname(sid), charindex('\', suser_sname(sid))-1 ) as domain,
substring( suser_sname(sid), charindex('\', suser_sname(sid))+1, len(suser_sname(sid)) ) as domain_user,
sid
from
sysusers
where
isntuser = 1
//rockmoose
You must unlearn what You have learnt
March 23, 2004 at 9:25 am
Perfect - exactly what I need. Thanks!
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply