Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 sql functions not giving changed username from AD

Author  Topic 

mandarapte409
Starting Member

11 Posts

Posted - 2011-12-09 : 03:57:42
Hello all,
I have a user named "ABC" added in AD(Active Directory). I logged into windows 7 machine with login name "ABC". I opened SQL management studio and run query "select SUSER_SNAME()". This query returned user name as "ABC". Now i have renamed the user in AD as "XYZ". Logged into windows 7 machine with new user name "XYZ". Now when i launched SQL MS and ran query "select SUSER_SNAME()" its still giving me user name as "ABC". Can anyone tell me what is the reason behind this? why is sql function still giving me old login user name? I have tried restarting sql service it did not work. Is there a solution for this other than machine reboot?

Maddy

sathiesh2005
Yak Posting Veteran

85 Posts

Posted - 2011-12-09 : 04:14:04
Did you logged off and Re-login your? windows7 after renaming your account in AD?


@Sathiesh
Go to Top of Page

james_wells
Yak Posting Veteran

55 Posts

Posted - 2011-12-09 : 10:11:59
Does the old name exist in

SELECT name, sid
FROM sys.login_token
where name = 'ABC'

Could be picking the old value from this view rather then AD

Go to Top of Page

mandarapte409
Starting Member

11 Posts

Posted - 2011-12-11 : 23:42:20
@sathiesh2005: Ya sathiesh i have logged off an logged in.

@james_wells : james when i query the sys.login_token i dont find that users username in it. Actually what i am trying to do is i am trying to connect to the sql server remotely. For connecting to sql server i am first executing suser_sname function. That itself is returning old name. So u want to say that suser_sname picks up the user name to display from login_token? after executing the query u have given i found all the groups names and not user names. In AD the user name will be in BUILTIN\Users group right so in sql just BUILTIN\Users group is added. So will dropping that group and recreating it will solve the issue?
Is there any other way to troubleshoot it? Please somebody help me??

Maddy
Go to Top of Page
   

- Advertisement -