Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2006
    Posts
    2

    Unanswered: procedure to retrieve primary key

    Hello!

    I want to write a stored procedure, that will insert new row into a table and return the key of newly inserted row.

  2. #2
    Join Date
    May 2004
    Location
    Seattle
    Posts
    1,313
    check out SCOPE_IDENTITY() in bol

    EDIT: i am assuming you are using an identity column for your pk. if you aren't, then you must already know the value you are inserting, right?

  3. #3
    Join Date
    Nov 2006
    Posts
    2
    That's exactly what I was looking for. Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •