sql - How to Insert N Records in a Single Stored Procedure Call -
how accomplish being able insert unknown number of records database using single stored procedure call?
say have table definition:
create table phone( phoneid int identity(1,1), phonenumber varchar(20), personid int )
and have following insert stored procedure:
create procedure dbo.usp_phone_insert @phonenumber varchar(20), @personid int insert phone values (@phonenumber, @personid)
how able transform insert number of records in single call stored procedure?
i have blog posts code samples address topic.
performance comparison of singleton, xml, , tvp inserts http://sqlfool.com/2008/11/performance-comparison-of-singleton-xml-and-tvp-inserts/
bulk inserts xml http://sqlfool.com/2008/11/bulk-inserts-with-xml/
one-to-many inserts table-valued parameters http://sqlfool.com/2008/11/one-to-many-inserts-with-table-valued-parameters/
hth.
Comments
Post a Comment