BUG: Incorrect Example D for sp_addlogin in SQL Server Books Online (257609)



The information in this article applies to:

  • Microsoft SQL Server 7.0

This article was previously published under Q257609
BUG #: 57513 (SQLBUG_70)

SYMPTOMS

SQL Server Books Online has incorrect syntax for example D in the sp_addlogin (T-SQL) topic.

CAUSE

SQL Server Books Online specifies that the datatype of the last parameter security identification number (SID) is varbinary(16); however, sp_addlogin checks for the binary(16) datatype.

WORKAROUND

Use this code to make example D work:
declare @v binary(16)

select @v= convert(binary(16),'0x12345678')

EXEC sp_addlogin 'Michael', 'chocolate', 'pubs', 'us_english', @v
				

STATUS

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

MORE INFORMATION

The sp_addlogin (T-SQL) topic is referenced as follows:

Building SQL Server applications -> Transact-SQL Reference -> System Stored Procedures -> sp_addlogin

The example in SQL Server Books Online is shown as follows:

EXEC sp_addlogin 'Michael', 'chocolate', 'pubs', 'us_english', '0x12345678'
				

However, running this statement causes this error message to occur:
Server: Msg 257, Level 16, State 2, Procedure sp_addlogin, Line 0
Implicit conversion from data type varchar to varbinary is not allowed. Use the CONVERT function to run this query.

Modification Type:MajorLast Reviewed:10/16/2002
Keywords:kbBug kbDSupport KB257609