BUG: Example E in the sp_addlogin Topic of SQL Server 2000 Books Online is Incorrect (279705)



The information in this article applies to:

  • Microsoft SQL Server 2000 (all editions)

This article was previously published under Q279705
BUG #: 351118 (SHILOH)

SYMPTOMS

The last example in the sp_addlogin page of SQL Server 2000 Books Online, Example E - Create a login ID and do not encrypt the password, is incorrect. If you follow the documented steps, an improper password is created on Server2.

CAUSE

Because the encrypted password is stored as a varbinary of 256 and the sample conversion in SQL Server Books Online has the user convert this password to varbinary(32) some of the password is truncated and hence unusable. Conversion to varbinary(256) is necessary to maintain the full password.

WORKAROUND

A corrected example would be:
-- Server1
EXEC sp_addlogin 'Margaret', 'Rose'

--Results
New login created.

-- Extract encrypted password for Margaret
SELECT CONVERT(VARBINARY(256), password)
   FROM syslogins
   WHERE name = 'Margaret'

--Results
------------------------------------------------------------------
0x0100DB3D1C10B6775505EEF640649992579B63FE255EAFE8BFF842E4B90B69CB1672D91F45A89859A3F7ADDEDDFE

(1 row(s) affected)

-- Server2
EXEC sp_addlogin 'Margaret',0x0100DB3D1C10B6775505EEF640649992579B63FE255EAFE8BFF842E4B90B69CB1672D91F45A89859A3F7ADDEDDFE,
   @encryptopt = 'skip_encryption'
				

STATUS

Microsoft has confirmed this to be a problem in SQL Server 2000.

Modification Type:MajorLast Reviewed:10/3/2003
Keywords:kbBug kbpending KB279705