Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2006

    Unanswered: How to use results of a select as SP input?

    Hello friends:

    I need to insert in TableB the results of a select over TableA so i used:
    Insert into TableB (col1, col2, col3) select c1, c2, c3 from TableA
    and works OK.

    But now i need to use a Stored Procedure "Insert_in_TableB" that handles all the process of checking values, inserting data, logging steps, etc etc. That receives via its parameters the values for validate, etc and then insert them in TableB.

    So, how can i execute that procedure (and define its parameters) in a easy way?
    something like
    Exec Insert_in_TableB (select c1, c2, c3 from TableA)
    Select c1, c2,c3 into Insert_in_TableB...

    Don't want to use cursors.

    if the only way is SSIS, please explain in detail.


  2. #2
    Join Date
    Jan 2003
    Provided Answers: 17
    You should be able to use:
    insert into tableB (col1, col2, col3)
    exec (storedprocA @param1, @param2)
    The syntax is a little tricky, and I don't know it offhand, so you may have to play around with it.

Posting Permissions

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