Actually I believe the syntax is:
Insert into tablename(field1, field2, field3, field4 ...)
Values
(value1, value2, value3, value4 ...),
(value1, value2, value3, value4 ...),
(value1, value2, value3, value4 ...);
Steve
-----Original Message-----
From: Mike K [mailto:[email protected]]
Sent: Friday, October 10, 2014 1:51 AM
To: cf-talk
Subject: Re: Avoiding a boat load of queries inserting multiple records -
Better Way?
You do know that Microsoft changed the insert syntax as from SQLServer 2008
dont you? now you can insert multiple records in one go like this:
INSERT into Tablename (field1, field2, field3, field4 ....) Values
( value1, value2, value3, value4 ... ;
value1, value2, value3, value4 .... ;
value1, value2, value3, value4 ....
)
IF you uave one of those fields as an index field (some databases call them
autonumber fields) you dont have to know what the current index value of
record 1 is when you insert record 2 . Or (i havent tried this buti
reckon it ought to work) if say field1 was your index field, you could
user the value Ident_Current('Tablename ') as the value of field1 in the
subsequent records.
Cheers
Mike Kear
Windsor, NSW, Australia
Adobe Certified Advanced ColdFusion Developer
AFP Webworks
http://afpwebworks.com
ColdFusion 9 Enterprise, PHP, ASP, ASP.NET hosting from AUD$15/month
On Fri, Oct 10, 2014 at 11:51 AM, Les Mizzell <[email protected]> wrote:
>
> > Not knowing much about your overall process, I'll try to stick to some
> > generic ideas. Let's assume you don't need this stuff dumped into the
> > database the very second it gets sent to you.
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:359444
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm