I agree. Where we are not using result attribute on older code we use
scope_identity() without issues on CF8 and we have never changed drivers.
Paul.
On 16/08/2010 8:02 AM, Scott Thornton wrote:
I have seen similar behaviour, I think it was with CF 8.
Using the Set nocount on option seemed to help.
<cfquery datasource="ds" name="qInsert">
set nocount on
INSERT
INTO TableName (Col1)
VALUES ('foobar')
SELECT @@IDENTITY AS 'NewID'
Set nocount off
</cfquery>
PS: SCOPE_IDENTITY() is a better choice. You never know when your
table may have an underlying insert trigger….
*From:* cfaussie@googlegroups.com [mailto:cfaus...@googlegroups.com]
*On Behalf Of *Paul Kukiel
*Sent:* Friday, 13 August 2010 5:27 PM
*To:* cfaussie@googlegroups.com
*Subject:* Re: [cfaussie] CF8 and MSSQL 2005/2008
Steve don't use @@identity you can achieve this result with CF alone:
http://cookbooks.adobe.com/post_Getting_the_ID_of_the_Last_Record_Inserted_Into_a-16522.html
and with CF9 its more generic:
http://cookbooks.adobe.com/post_Generated_key___Get_the_ID_of_the_inserted_record-16593.html
Paul.
On Fri, Aug 13, 2010 at 5:19 PM, Steve Onnis <st...@cfcentral.com.au
<mailto:st...@cfcentral.com.au>> wrote:
Is there an updated driver for SQL Server? I have come across this
issue where if i run this query:-
<cfquery datasource="ds" name="qInsert">
INSERT
INTO TableName (Col1)
VALUES ('foobar')
SELECT @@IDENTITY AS 'NewID'
</cfquery>
Under CF8 it errors saying *_qInsert_* is undefined but under CF9 it
runs fine.
Steve
--
You received this message because you are subscribed to the Google
Groups "cfaussie" group.
To post to this group, send email to cfaussie@googlegroups.com
<mailto:cfaussie@googlegroups.com>.
To unsubscribe from this group, send email to
cfaussie+unsubscr...@googlegroups.com
<mailto:cfaussie%2bunsubscr...@googlegroups.com>.
For more options, visit this group at
http://groups.google.com/group/cfaussie?hl=en.
--
Paul Kukiel
--
You received this message because you are subscribed to the Google
Groups "cfaussie" group.
To post to this group, send email to cfaus...@googlegroups.com.
To unsubscribe from this group, send email to
cfaussie+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/cfaussie?hl=en.
--
You received this message because you are subscribed to the Google
Groups "cfaussie" group.
To post to this group, send email to cfaus...@googlegroups.com.
To unsubscribe from this group, send email to
cfaussie+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/cfaussie?hl=en.
--
You received this message because you are subscribed to the Google Groups
"cfaussie" group.
To post to this group, send email to cfaus...@googlegroups.com.
To unsubscribe from this group, send email to
cfaussie+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/cfaussie?hl=en.