tsql - CFQuery Getting GeneratedKey from Multiple Insert into SQL Server -
i trying generated keys (or identitycol) of rows inserting using multiple insert syntax.
<cfquery> create table tempperson ( personid int not null identity (1,1) primary key, lastname varchar(20), firstname varchar(20) ); </cfquery> <cfquery result="qrresult"> insert tempperson( lastname, firstname ) values( 'smith', 'michael' ), ('jones','ricky') </cfquery> <cfdump var="#qrresult#">
i ran in both cf10 , railo 4.2 in combination both sql server , mysql.
cf10 sql server - no generatedkey returned. recordcount variable
recordcount = 2
cf10 mysql - identity columns list, wrong recordcount
generatedkey = 1,2 recordcount = 1
railo 4.2 sql server - gets last identity column
generatedkey = 2 recordcount = 2
railo 4.2 mysql - identity columns list, , right recordcount
generatedkey = 1,2 recordcount = 2
so looks there no consistency in 4 permutations. urgent issue whether there way generated keys sql server running cf10. there?
using sql output
<cfquery name="qrresult"> insert tempperson( lastname, firstname ) output inserted.personid values( 'smith', 'michael' ), ('jones','ricky') </cfquery>
it can used regular data
Comments
Post a Comment