tags:

views:

25

answers:

2

We are using suser_sname() and SYSTEM_USER to return the user name (via trust connection). Within the past month, someone's login name was changed in Active Directory. However these 2 functions are still returning the old login name.

The individual has rebooted their PC several times since the change. I'm not sure if the servers were rebooted since then. One of them will be rebooted tomorrow, which we are assuming will remedy the situation for the one server.

Is there another way for SQL Server to recognize this change without rebooting (assuming that rebooting fixes it).

EDIT: The individual's login doesn't exist in SQL Server, but AD Groups in which they are a member, are on the server.

e.g., Domain\AtticusFinch is not setup in SQL, but Domain\Lawyers does exist. In this case, Atticus' login was changed to Domain\AtticusF1

EDIT 2: Simply stopping and starting the SQL Service doesn't remedy the problem. Rebooting, however, did fix it.

A: 

See if using SUSER_SNAME(SUSER_SID()) instead of SUSER_SNAME() makes a difference.

Joe Stefanelli
No, this makes no difference. The old user name is returned.
Clownish Carnage
+1  A: 

I've seen this before but it's been some time.

I only saw it for login where there was an entry in sys.server_principals. Not purely via group membership.

Try this using ALTER LOGIN

ALTER LOGIN [domain\oldlogin] WITH NAME = [domain\newlogin]
gbn
My bad. AD group(s) were setup (i.e. Domain\Users ); the individual's login was never explicitly setup on the server. It's as if the system is caching their old login. So, Altering the login will not work, since it doesn't exist.
Clownish Carnage
The system does cache unfortunately. AFAIK, you'd have to restart SQL Server
gbn