If you're wanting to stick to Insert, you could probably use an insert statement with a selectkey node that simply returned @@ROWCOUNT instead of the identity value. (This assumes you are using MS SQL). _____
From: Gilles Bayon [mailto:[EMAIL PROTECTED] Sent: Monday, January 15, 2007 12:49 PM To: [email protected] Subject: Re: Rows affected count from bulk insert select. You can do it, see inspiration below < statement id=" InsertCategory" parameterClass=" Category" resultClass=" int"> insert into Categories (Category_Name, Category_Guid) values (#Name#, #Guid:UniqueIdentifier#); select SCOPE_IDENTITY() as value </statement> int key = (int)sqlMap.Insert("InsertCategory", category); Replace select SCOPE_IDENTITY() as value by SELECT @@ROWCOUNT as value On 1/15/07, Jason Finch <[EMAIL PROTECTED]> wrote: I am interested to know how best to go about getting the rows affected count from a statement such as this using iBatis: <statement id="Measure-Snapshot-Insert" parameterClass="System.Int32"> INSERT INTO [Measure] (LocationId,ReportGroupId,MeasureTypeId,PeriodId,SnapshotId,Value) SELECT LocationId,ReportGroupId,MeasureTypeId,PeriodId,$value$ AS SnapshotId, TotalValue FROM [Measure] WHERE SnapShotId IS NULL </statement> I first tried this as an <Update> statement, but received error about not using INSERT into an UPDATE so I revered to a general <statement>. Do only Update and Delete return rowcounts? Should I append a SELECT @@ROWCOUNT to the end of the statement? I'd rather not wrapper this in a stored proc if possible. Thanks, Jason This correspondence is for the named persons only. It may contain confidential or privileged information or both. No confidentiality or privilege is waived or lost by any mis transmission. If you receive this correspondence in error please delete it from your system immediately and notify the sender. You must not disclose, copy or relay on any part of this correspondence, if you are not the intended recipient. Any opinions expressed in this message are those of the individual sender except where the sender expressly, and with the authority, states them to be the opinions of the Department of Emergency Services, Queensland. -- Cheers, Gilles <a href="http://www.amazon.com/gp/registry/6JCP7AORB0LE ">Wish List</a> -------------------------------------------------------- Princeton Retirement Group, Inc - Important Terms This E-mail is not intended for distribution to, or use by, any person or entity in any location where such distribution or use would be contrary to law or regulation, or which would subject Princeton Retirement Group, Inc. or any affiliate to any registration requirement within such location. This E-mail may contain privileged or confidential information or may otherwise be protected by work product immunity or other legal rules. No confidentiality or privilege is waived or lost by any mistransmission. Access, copying or re-use of information by non-intended or non-authorized recipients is prohibited. If you are not an intended recipient of this E-mail, please notify the sender, delete it and do not read, act upon, print, disclose, copy, retain or redistribute any portion of this E-mail. The transmission and content of this E-mail cannot be guaranteed to be secure or error-free. Therefore, we cannot represent that the information in this E-mail is complete, accurate, uncorrupted, timely or free of viruses, and Princeton Retirement Group, Inc. cannot accept any liability for E-mails that have been altered in the course of delivery. Princeton Retirement Group, Inc. reserves the right to monitor, review and retain all electronic communications, including E-mail, traveling through its networks and systems (subject to and in accordance with local laws). If any of your details are incorrect or if you no longer wish to receive mailings such as this by E-mail please contact the sender by reply E-mail. --------------------------------------------------------

