a select statement to pass parameters to a stored procedure

Posted on 2006-05-30
Last Modified: 2008-03-10
Hi ...

I call a stored procedure by using 'execute' into an another stored procedure.
I would like pass some parameters with a select statement.

Something like that :

exec stp_order_insert   (select param1,param2 from table3 where x=@param3 and Y=@Param4)

My stp_order_insert needs 2 parameters are integers.
I think my select statement returns a string and that's why my execute failed .

Question by:PROMISYS
    LVL 142

    Accepted Solution

    declare @param1 int
    declare @param2 int
    select @param1 = param1,@param2 = param2 from table3 where x=@param3 and Y=@Param4

    exec stp_order_insert   @param1, @param2
    LVL 75

    Assisted Solution

    by:Aneesh Retnakaran
    declare @param11 int,@param21 int
    select @param11 = param1,@param21 =param2 from table3 where x=@param3 and Y=@Param4
    exec stp_order_insert @param11, @param21

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    Suggested Solutions

    Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
    For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
    Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
    Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now