Try this one bro:
Code:
ALTER PROCEDURE dbo.AddItemRecord
(
@id int = NULL,
@description int = NULL
)
AS
SELECT @id = COUNT(*) FROM ITEM;
INSERT INTO Item
(id, description)
VALUES (@id,@description)
I just notice na you update you @id variable from within the Script, I suggest not to declare @id as parameter of SP but rather a variable within the script like:
Code:
ALTER PROCEDURE dbo.AddItemRecord
(
@description int = NULL
)
AS
Declare @id int;
SELECT @id = COUNT(*) FROM ITEM;
INSERT INTO Item (id, description)
VALUES (@id,@description)