Hi
I have a store procedure, I want when I insert a record, I can have its id (Poll_ID, it is my primary key) as a output , would you please help me? here is my store procedure :
ALTER PROCEDURE dbo.InsertNewPoll
@varquestion nvarchar(500),
@Poll_I int
AS
begin
INSERT INTO Polls(Question, Active)
VALUES (@varquestion, 1)
select @Poll_ID=(Poll_ID) from Polls where Question=@varquestion
end