retriving data from an insert....


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: retriving data from an insert....

  1. #1
    Guillermo Guest

    retriving data from an insert....


    hi!
    i'm doing an insert into a table which has an identity column but i need
    in an output parameter that new identity number to do an insert in another
    table with it, Could anybody help me please?. Thanks

  2. #2
    DaveSatz Guest

    Re: retriving data from an insert....

    if you create a stored proc for the 1st insert, you could return the
    identity

    INSERT table (...)
    VALUES (...)

    -- do not return NULL value
    -- SQL Server will return a negative error code if insert failed
    IF @@IDENTITY IS NOT NULL
    RETURN @@IDENTITY


    --
    HTH,
    David Satz
    Principal Software Engineer
    Hyperion Solutions
    ->Using SQL Server 7.0 SP3/6.5 SP5a/Cold Fusion 4.5.1 SP2/VSS
    (Please reply to group only - emails answered rarely)
    -----------------------------------------------------------------

    "Guillermo" <polonskyg@yahoo.com> wrote in message
    news:3b03e264$1@news.devx.com...
    >
    > hi!
    > i'm doing an insert into a table which has an identity column but i need
    > in an output parameter that new identity number to do an insert in another
    > table with it, Could anybody help me please?. 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
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center