Executing a Stored Procedure from a Stored Procedure


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Executing a Stored Procedure from a Stored Procedure

  1. #1
    Join Date
    Mar 2004
    Posts
    72

    Executing a Stored Procedure from a Stored Procedure

    I am trying the following line of code from a Stored Procedure. It does not seem to work. The Address_Insert Stored Procedure returns an Address_ID. I am trying to set an @Address_ID paramater to the value of the varable returned by the Address_Insert Stored Procedure. How do you do that?

    SET @Address_ID = (EXEC Address_Insert @Address_1, @Address_2, @City, @Abbrev, @Zip)

  2. #2
    Join Date
    Aug 2004
    Posts
    64
    I'm not positive, but try using SELECT instead of SET

  3. #3
    Join Date
    Mar 2004
    Posts
    72
    SELECT does not work in any of these cases:

    SELECT @Address_ID = (EXEC Address_Insert @Address_1, @Address_2, @City, @Abbrev, @Zip)
    SELECT @Address_ID = EXEC Address_Insert @Address_1, @Address_2, @City, @Abbrev, @Zip
    SELECT @Address_ID as (EXEC Address_Insert @Address_1, @Address_2, @City, @Abbrev, @Zip)
    SELECT @Address_ID as EXEC Address_Insert @Address_1, @Address_2, @City, @Abbrev, @Zip

  4. #4
    Join Date
    Nov 2004
    Location
    Huddinge, Sweden
    Posts
    283
    Quote Originally Posted by hoyaabanks
    I am trying the following line of code from a Stored Procedure. It does not seem to work. The Address_Insert Stored Procedure returns an Address_ID. I am trying to set an @Address_ID paramater to the value of the varable returned by the Address_Insert Stored Procedure. How do you do that?

    SET @Address_ID = (EXEC Address_Insert @Address_1, @Address_2, @City, @Abbrev, @Zip)
    Code:
    EXECUTE @Address_ID = Address_Insert @Address_1, @Address_2, @City, @Abbrev, @Zip
    I don't want to be mean, but this is a case where SQL Server Books Online is quite helpful. That is probably a bit quicker than waiting for replies on online forums.

    Rune
    If you hit a brick wall, you didn't jump high enough!

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