BUG: Books Online Example Stored Procedure Sp_SetMark (279083)



The information in this article applies to:

  • Microsoft SQL Server 2000 (all editions)

This article was previously published under Q279083
BUG #: 235795 (SHILOH_BUGS)

SYMPTOMS

In the Microsoft SQL Server 2000 Books Online "Administrator's Companion", the "Backup and Restore Operations" topic has a subsection titled "Backup and Recovery of Related Databases" that contains an error in one of the T-SQL examples. The example is as follows:
CREATE PROCEDURE sp_SetMark
@name nvarchar (128)
AS
BEGIN TRANSACTION @name WITH MARK
UPDATE coyote.dbo.Marks SET on = 1
COMMIT TRANSACTION
GO
				
If you run this code, you may receive the following error message:
Server: Msg 156, Level 15, State 1, Line 5
Incorrect syntax near the keyword 'on'.
				

CAUSE

The example code for creating the sp_SetMark stored procedure has a syntax error due to the reserved keyword "ON".

WORKAROUND

Rewrite the stored procedure code as follows:
CREATE PROCEDURE sp_SetMark
@name nvarchar (128)
AS
BEGIN TRANSACTION @name WITH MARK
UPDATE coyote.dbo.Marks SET one = 1
COMMIT TRANSACTION
GO
				

STATUS

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

Modification Type:MajorLast Reviewed:10/3/2003
Keywords:kbbug kbpending KB279083