What is wrong with this SP?

  • set ANSI_NULLS ON

    set QUOTED_IDENTIFIER ON

    go

    ALTER PROCEDURE [dbo].[lu_Ethnicity_Insert_One]

    (

    @nvcEthnicity nvarchar(30),

    @nvcASCU nvarchar(256)

    )

    AS

    SET NOCOUNT OFF;

    DECLARE @intDspSeqNbr int

    SET @intDspSeqNbr = select (max(intDspSeqNbr) + 100) from lu_Ethnicity

    INSERT INTO lu_Ethnicity(nvcEthnicity, intDspSeqNbr, dtASCD, nvcASCU)

    VALUES(@nvcEthnicity, @intDspSeqNbr, getdate(), @nvcASCU);

  • what error msg are you getting ?!

    One thing that I can see is in your 'Set' statement - it should actually be...

    SELECT @intDspSeqNbr = (max(intDspSeqNbr) + 100) from lu_Ethnicity

    ...Other than that the only thing I see are the semicolons which are redundant...if you post your error message it'd give someone here a better idea....







    **ASCII stupid question, get a stupid ANSI !!!**

  • This worked:

    set ANSI_NULLS ON

    set QUOTED_IDENTIFIER ON

    go

    ALTER PROCEDURE [dbo].[lu_Ethnicity_Insert_One]

    (

    @nvcEthnicity nvarchar(30),

    @nvcASCU nvarchar(256)

    )

    AS

    SET NOCOUNT OFF;

    DECLARE @intDspSeqNbr int

    SET @intDspSeqNbr = (select (max(intDspSeqNbr) + 100) from lu_Ethnicity)

    SELECT @intDspSeqNbr

    INSERT INTO lu_Ethnicity(nvcEthnicity, intDspSeqNbr, dtASCD, nvcASCU)

    VALUES(@nvcEthnicity, @intDspSeqNbr, getdate(), @nvcASCU);

  • looks similar to something ive seen...what error message where you getting ?

     

    don farrell - dbase technologies - http://www.dbase.ie 

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

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