Mark,

That was before SQL Server 2008.  Your way still works, but this was an 
addition to the TSQL language.

Steve

-----Original Message-----
From: Gaulin, Mark [mailto:mark.gau...@ihs.com] 
Sent: Friday, October 10, 2014 9:04 AM
To: cf-talk
Subject: RE: Avoiding a boat load of queries inserting multiple records - 
Better Way?


My experience with MS SQL Server is that you have to do multiple inserts using 
a series of UNION statements...

Insert into tablename(field1, field2, field3, field4 ...) 
select value1, value2, value3, value4 ...
union all select value1, value2, value3, value4 ...
union all select value1, value2, value3, value4 ...
union all select value1, value2, value3, value4 ...

Thanks
        Mark

-----Original Message-----
From: DURETTE, STEVEN J [mailto:sd1...@att.com] 
Sent: Friday, October 10, 2014 8:19 AM
To: cf-talk
Subject: RE: Avoiding a boat load of queries inserting multiple records - 
Better Way?


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:afpwebwo...@gmail.com]
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 <lesm...@bellsouth.net> 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:359446
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to