Share via


Renaming Domain User Accounts and SQL

Question

Wednesday, July 21, 2010 1:10 PM | 1 vote

User (jsmith). had access to several Databases.  The User got married and changed their name(Jhelp).  Now they don't have access to any of the databases. I did a rename within Windows by just Renaming the User ID. The user still has rights to all the groups and access to all windows files/folders/application which all work except the applications that call a SQL Database.

Why can I not just rename a user account?

FFalcon1961

All replies (4)

Wednesday, July 21, 2010 1:40 PM âś…Answered | 2 votes

Which version of SQL Server are you running?   In SQL Server 2005 and up you should be able to use the ALTER LOGIN command to make this change since the SID of the Windows login has not changed.

ALTER LOGIN [domain\jsmith] WITH NAME = [domain\jhelp];

I remember trying to do this in an earlier version of SQL Server, for a very similar reason, and I finally had to delete the login from the SQL Server and re-add it with the new name. 

RLF

 


Thursday, July 22, 2010 9:00 AM

As Russell answered, as long as SID of the Windows login not changing the login name can be renamed using ALTER Login on SQL Server 2005 onwards.Sivaprasad S http://sivasql.blogspot.com Please click the Mark as Answer button if a post solves your problem!


Thursday, July 29, 2010 7:08 PM

We use Groups and not the indiviaul user id to setup the security. Our thought if they are in the group than they should work. However it does not.

 

FFalcon1961


Thursday, July 29, 2010 7:24 PM

But it is very easy for a user given access through a group, to become physically present in the server as a login or user.   For example:

1. If they set their default database, a server login is materialized for their Windows login.

2. If they create a database objects (table, procedure, etc.) without specifying dbo.  and it creates a personally owned object, a database user is materialized.

If either of these things (and probably some other possibilities) happen, the SID of the user is materialized in the login and/or user rows.  So, check the server for any of these.

RLF