Help: create Procedure sp_help_revlogin

  • I copied the procedure from Microsoft's site to create this procedure, but when I execute the script I keep getting the error: "Server: Msg 170, Level 15, State 1, Procedure sp_help_revlogin, Line 1 Line 1: Incorrect syntax near 'BEGIN'."

    Has anyone else gotten this error and figure it out? I'm running the script on a SQL7 server.

    Thanks,

    Mark.

  • The sp_help_revlogin proc calls another one that you need also. It is sp_hexadecimal, I have included it here.

    SET QUOTED_IDENTIFIER ON

    GO

    SET ANSI_NULLS ON

    GO

    /****** Object: Stored Procedure dbo.sp_hexadecimal Script Date: 8/22/2002 9:08:43 AM ******/

    if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sp_hexadecimal]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)

    drop procedure [dbo].[sp_hexadecimal]

    GO

    CREATE PROCEDURE sp_hexadecimal

    @binvalue varbinary(256),

    @hexvalue varchar(256) OUTPUT

    AS

    DECLARE @charvalue varchar(256)

    DECLARE @i int

    DECLARE @length int

    DECLARE @hexstring char(16)

    SELECT @charvalue = '0x'

    SELECT @i = 1

    SELECT @length = DATALENGTH (@binvalue)

    SELECT @hexstring = '0123456789ABCDEF'

    WHILE (@i <= @length)

    BEGIN

    DECLARE @tempint int

    DECLARE @firstint int

    DECLARE @secondint int

    SELECT @tempint = CONVERT(int, SUBSTRING(@binvalue,@i,1))

    SELECT @firstint = FLOOR(@tempint/16)

    SELECT @secondint = @tempint - (@firstint*16)

    SELECT @charvalue = @charvalue +

    SUBSTRING(@hexstring, @firstint+1, 1) +

    SUBSTRING(@hexstring, @secondint+1, 1)

    SELECT @i = @i + 1

    END

    SELECT @hexvalue = @charvalue

    GO

    SET QUOTED_IDENTIFIER OFF

    GO

    SET ANSI_NULLS ON

    GO

  • The script I'm trying to run includes the sp_hexadecimal procedure. I'm stuck trying to figure out a script that's supposed to work but gives me an error. I'm not sure where to start looking to fix the error. It's not very specific.

    Mark 🙂

  • Do sp_hexadecimal and sp_help_revlogin both exist on your master datase?

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply