i want to have my primary key as output , when i insert a record!

  • 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

  • duplicate post. No replies please.

    Please use the original post



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

Viewing 2 posts - 1 through 2 (of 2 total)

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