Inserting Multiple Rows in SP

  • Hi,

    For a input i have many output rows.I have insert these rows in to a table in Sql Server. Please let me know how can we do efficiently in Sql Stored Procedure.

  • hi

    Given information is not enough to provide answer.. can u pls explain your issue with sample?

  • probably u may expect a query like as following

    insert into table2(col1,col2) select col1,col2 from table1 where condition

  • Yes. For example say, a training session can have many programs. So we pass a session id and it gives many programs.I need to insert all these programs in to table at a time. In stored procedure what logic can be done with out any performance hit....

    Thanks...

  • Hi..

    According to me following query is best possible way to insert mulitple record in a table....

    insert into table2(col1,col2) select col1,col2 from table1 where session_id=1

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply