This is my stored procedure and it gives the following error, I'm new to sql server stored procs so I'm sure its some basic error...
Incorrect syntax near the keyword 'IDENTITY'.Procedure(InsITRRComments)
CREATE PROCEDURE dbo.InsITRRComments
@CommentId int IDENTITY,
@DacType varchar(25),
@DacTypeId int,
@TypeOfComment varchar(50),
@Comments varchar(4000),
@RiskId_External_ID varchar(16),
@UserId varchar(25),
@FullUserName varchar(50),
@AmendedDateTime datetime,
@ProcessedFlag char(1)
AS
BEGIN
/*************************************************************************
*
* Name: InsITRRComments
*
* Description: Insert new Term Type item.
*
* Inputs:
* @CommentId
* @DacType
* @DacTypeId
* @TypeOfComment
* @Comments
* @RiskId_External_ID
* @UserId
* @FullUserName
* @AmendedDateTime
* @ProcessedFlag
*
* Outputs: None
*
*
* Notes:
*
* History:
* Date Author Changes
* ---------- -------------- -------------------------------------------
* 16 Sept 05 Noel Nicholson Original
*************************************************************************/
---------------------------------------------------------------------------
IF EXISTS( SELECT * FROM ITRRComments WHERE CommentId = @CommentId )
BEGIN
RAISERROR('Stored Proc:InsITRRComments: You cannot insert a duplicate item. Insert failed.',16,1)
RETURN
END
set identity_insert ITRRComments on
INSERT INTO ITRRComments
VALUES (
@CommentId,
@DacType,
@DacTypeId,
@TypeOfComment,
@Comments,
@RiskId_External_ID,
@UserId,
@FullUserName,
@AmendedDateTime,
'N'
)
END
Incorrect syntax near the keyword 'IDENTITY'.Procedure(InsITRRComments)
CREATE PROCEDURE dbo.InsITRRComments
@CommentId int IDENTITY,
@DacType varchar(25),
@DacTypeId int,
@TypeOfComment varchar(50),
@Comments varchar(4000),
@RiskId_External_ID varchar(16),
@UserId varchar(25),
@FullUserName varchar(50),
@AmendedDateTime datetime,
@ProcessedFlag char(1)
AS
BEGIN
/*************************************************************************
*
* Name: InsITRRComments
*
* Description: Insert new Term Type item.
*
* Inputs:
* @CommentId
* @DacType
* @DacTypeId
* @TypeOfComment
* @Comments
* @RiskId_External_ID
* @UserId
* @FullUserName
* @AmendedDateTime
* @ProcessedFlag
*
* Outputs: None
*
*
* Notes:
*
* History:
* Date Author Changes
* ---------- -------------- -------------------------------------------
* 16 Sept 05 Noel Nicholson Original
*************************************************************************/
---------------------------------------------------------------------------
IF EXISTS( SELECT * FROM ITRRComments WHERE CommentId = @CommentId )
BEGIN
RAISERROR('Stored Proc:InsITRRComments: You cannot insert a duplicate item. Insert failed.',16,1)
RETURN
END
set identity_insert ITRRComments on
INSERT INTO ITRRComments
VALUES (
@CommentId,
@DacType,
@DacTypeId,
@TypeOfComment,
@Comments,
@RiskId_External_ID,
@UserId,
@FullUserName,
@AmendedDateTime,
'N'
)
END