Errors in Updatestore proc

  • Plz help me understand why I am getting these errors:

    Msg 102, Level 15, State 1, Procedure createAlter, Line 2

    Incorrect syntax near 'int'.

    Msg 102, Level 15, State 1, Procedure createAlter, Line 34

    Incorrect syntax near ','.

    CREATE PROCEDURE [dbo].[createAlter]

    @[ID][int],

    @[Title] [varchar](100),

    @[Message] [varchar](max)NULL,

    @[IsSensitive] [bit],

    @[JurisdictionTypeID] [tinyint],

    @[DeliveryTimeTypeID] [tinyint],

    @[SeverityTypeID] [tinyint],

    @[CalloutStatusTypeID] [tinyint],

    @[ContactByEmail] [tinyint],

    @[ContactByWorkPhone] [tinyint],

    @[ContactByCellPhone] [tinyint],

    @[ContactByHomePhone] [tinyint],

    @[ContactByFax] [tinyint],

    @[ContactByAlphaPager] [tinyint],

    @[ContactBYNumericPager] [tinyint],

    @[ContactBySMS] [tinyint],

    @[Attempts] [tinyint],

    @[IncludeNotificationDescriptor] [bit],

    @[AcknowledgementRequired] [bit],

    @[AlertTypeID] [tinyint],

    @[CreateDate] [smalldatetime],

    @[CreatePerson] [varchar](50),

    @[ApprovalDate] [datetime],

    @[ApprovalPerson] [varchar](50),

    AS

    BEGIN

    -- SET NOCOUNT ON added to prevent extra result sets from

    -- interfering with SELECT statements.

    SET NOCOUNT ON;

    -- Insert statements for procedure here

    INSERT INTO

    (ID,Title,Message,IsSensitive,JurisdictionTypeID,DeliveryTimeTypeID,SeverityTypeID,CalloutStatusTypeID,

    ContactByEmail,ContactByWorkPhone,ContactByCellPhone,ContactByHomePhone,ContactByFax,ContactByAlphaPager,ContactBYNumericPager,

    ContactBySMS,Attempts,IncludeNotificationDescriptor,AcknowledgementRequired,AlertTypeID,CreateDate,CreatePerson,ApprovalDate,ApprovalPerson)

    VALUES (@ID,@Title,@Message,@IsSensitive,@JurisdictionTypeID,@DeliveryTimeTypeID,@SeverityTypeID,@CalloutStatusTypeID,

    @ContactByEmail,@ContactByWorkPhone,@ContactByCellPhone,@ContactByHomePhone,@ContactByFax,@ContactByAlphaPager,@ContactBYNumericPager,

    @ContactBySMS,@Attempts,@IncludeNotificationDescriptor,@AcknowledgementRequired,@AlertTypeID,@CreateDate,@CreatePerson,@ApprovalDate,@ApprovalPerson)

    END

    GO

  • remove the square brackets from around the variable names.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Thank you so much Gail

    Still I am getting this

    Msg 156, Level 15, State 1, Procedure createAlter, Line 31

    Incorrect syntax near the keyword 'AS'.

    Msg 102, Level 15, State 1, Procedure createAlter, Line 39

    Incorrect syntax near ','.

  • And your new fixed code code looks like .... ???

    Your original code has an extra comma, right before the AS. If you haven't fixed that, remove it.

    btw, you do know that you can double-click on the error and be taken to the line with the error? It's a lot faster than posting here and waiting for someone with a few free minutes.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Thanks in advance Gail..

    Where should I move this 'AS'?

    SET ANSI_NULLS ON

    GO

    SET QUOTED_IDENTIFIER ON

    GO

    -- =============================================

    -- Author:<Kalpana Dhungel>

    -- Create date: <Nov 08 2010>

    -- Description:<enter records in required fields>

    -- =============================================

    CREATE PROCEDURE [dbo].[createAlter]

    @ID int,

    @Title varchar(100),

    @Message varchar(max),

    @IsSensitive bit,

    @JurisdictionTypeID tinyint,

    @DeliveryTimeTypeID tinyint,

    @SeverityTypeID tinyint,

    @CalloutStatusTypeID tinyint,

    @ContactByEmail tinyint,

    @ContactByWorkPhone tinyint,

    @ContactByCellPhone tinyint,

    @ContactByHomePhone tinyint,

    @ContactByFax tinyint,

    @ContactByAlphaPager tinyint,

    @ContactBYNumericPager tinyint,

    @ContactBySMS tinyint,

    @Attempts tinyint,

    @IncludeNotificationDescriptor bit,

    @AcknowledgementRequired bit,

    @AlertTypeID tinyint,

    @CreateDate smalldatetime,

    @CreatePerson varchar(50),

    @ApprovalDate datetime,

    @ApprovalPerson varchar(50),

    AS

    BEGIN

    -- SET NOCOUNT ON added to prevent extra result sets from

    -- interfering with SELECT statements.

    SET NOCOUNT ON;

    -- Insert statements for procedure here

    INSERT INTO CreateAlter

    (ID,Title,Message,IsSensitive,JurisdictionTypeID,DeliveryTimeTypeID,SeverityTypeID,CalloutStatusTypeID,

    ContactByEmail,ContactByWorkPhone,ContactByCellPhone,ContactByHomePhone,ContactByFax,ContactByAlphaPager,ContactBYNumericPager,

    ContactBySMS,Attempts,IncludeNotificationDescriptor,AcknowledgementRequired,AlertTypeID,CreateDate,CreatePerson,ApprovalDate,ApprovalPerson)

    VALUES (@ID,@Title,@Message,@IsSensitive,@JurisdictionTypeID,@DeliveryTimeTypeID,@SeverityTypeID,@CalloutStatusTypeID,

    @ContactByEmail,@ContactByWorkPhone,@ContactByCellPhone,@ContactByHomePhone,@ContactByFax,@ContactByAlphaPager,@ContactBYNumericPager,

    @ContactBySMS,@Attempts,@IncludeNotificationDescriptor,@AcknowledgementRequired,@AlertTypeID,@CreateDate,@CreatePerson,@ApprovalDate,@ApprovalPerson)

    END

    GO

  • Don't move it. Remove the comma before it.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • This works now:-)

    Thanks a bunch

Viewing 7 posts - 1 through 6 (of 6 total)

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