What kind of database? MSSql? Mysql? Oracle? ...
---------------------------------- William Seiter -----Original Message----- From: Les Mizzell [mailto:lesm...@bellsouth.net] Sent: Thursday, October 09, 2014 1:29 PM To: cf-talk Subject: Re: Avoiding a boat load of queries inserting multiple records - Better Way? On 10/9/2014 1:49 PM, Cameron Childress wrote: > Most databases will let you issue multiple SQL statements in a single > request/transaction. You just have to separate them with a semicolon. If you did it this way, how would you get the ID from the first insert for use in the 2nd ... (because I'm looking at stored procedures and I'm not ashamed to admit that doing that inside SQL Server is beyond my coding capabilities - unless somebody can point me to /The Complete Idiot's Guide to Writing this Procedure with SqlServer 10/ (which I've been looking for but haven't found yet...) So something like: <cfquery> <cfloop> insert into table_1 (...) values (...); insert into table_2 (table_1_id, other_stuff) values (#Id_from_above_insert#, #other_stuff# ) </cfloop> </cfquery> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:359436 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm