PRB: Problem Creating New Login

Last reviewed: April 25, 1997
Article ID: Q73559

The information in this article applies to:

  - Microsoft SQL Server version 4.2 for OS/2

SYMPTOMS

When trying to create a new login and user name, the following message is received:

   User already has a login under a different name.

This happens using either SAF or the system procedures (sp_addlogin followed by sp_adduser).

CAUSE

This problem occurs only if the numerically last login [that is, the login in the syslogins table with max(suid)] has been deleted from the syslogins table and the username(s) associated with it has not been deleted. Any login/user name combination created thereafter may receive the above message.

In the sp_addlogin procedure, a unique identifier (suid) for a new login is generated by using max(suid+1) in the query. If the numerically last login in the syslogins table is deleted, its suid will be reused by whatever login is created next. In addition, if the user names previously associated with this suid were not deleted, the mappings still exist from the syslogins table in the master database to the sysusers table(s) in the other database(s). Note that this is also the case if the last (n) logins are deleted without deleting the associated user names, since all the suid's will be reused.

The following are two examples of duplicate logins:

Using SAF Menu Functions

  1. If the default database for the new login is the same as that for the login just deleted, the user receives the message, "User already has a login under a different name." The new user name is disregarded and the old user name is granted privileges again.

  2. The default database specified for the new login is different from that for the login just deleted. In this case, the user receives no message. The new login is created in the master database. The new user name is created in the default database. In addition, the mapping with the old user name is maintained. This is possible because a login can have several user names associated with it, provided they are in different databases.

WORKAROUND

Under most circumstances, neither SAF nor the stored procedures notify the user to drop a login that has associated user names. Thus, whenever a login is to be deleted, ALL the user names associated with it (in one or several databases) must be deleted. This is mentioned on page 114 of the "Microsoft SQL Server System Administrator's Guide." This problem becomes immediately noticeable only if the numerically last login is dropped.


Additional query words:
Keywords : kbother SSrvAdmin
Version : 4.2
Platform : OS/2


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: April 25, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.