DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Matt Markus Guest

    newbie question....

    I want to write a stored procedure that inserts a record into a table and
    return the ID of the newly created record.

    Example:

    CREATE PROCEDURE SetStatus
    AS

    Insert Into Status(Success) Values(1)

    'here I want to return the new ID that was created when the above statement
    executed

    Thanks!



  2. #2
    Matt Markus Guest

    Re: newbie question....

    Never mind - figured it out

    "Matt Markus" <matt_markus@hotmail.com> wrote in message
    news:3ca8d54e@10.1.10.29...
    > I want to write a stored procedure that inserts a record into a table and
    > return the ID of the newly created record.
    >
    > Example:
    >
    > CREATE PROCEDURE SetStatus
    > AS
    >
    > Insert Into Status(Success) Values(1)
    >
    > 'here I want to return the new ID that was created when the above

    statement
    > executed
    >
    > Thanks!
    >
    >




  3. #3
    Michael Tzoanos Guest

    Re: newbie question....


    Hope you used @@Identity to return as an output parameter

    "Matt Markus" <matt_markus@hotmail.com> wrote:
    >Never mind - figured it out
    >
    >"Matt Markus" <matt_markus@hotmail.com> wrote in message
    >news:3ca8d54e@10.1.10.29...
    >> I want to write a stored procedure that inserts a record into a table

    and
    >> return the ID of the newly created record.
    >>
    >> Example:
    >>
    >> CREATE PROCEDURE SetStatus
    >> AS
    >>
    >> Insert Into Status(Success) Values(1)
    >>
    >> 'here I want to return the new ID that was created when the above

    >statement
    >> executed
    >>
    >> Thanks!
    >>
    >>

    >
    >



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links