you need to wrap your sql in a NOCOUNT block to stop sql server
from returning intermediate result sets AND you also do not need to
use sql server vars (@New_ID).

> <cfquery name="InsertThenSelect" datasource="my database">

SET NOCOUNT ON

> INSERT INTO My_Table (Data_Name, Data_Description)
> VALUES ('Here's my data', 'Heres my description')
> 
> select New_ID = @@identity

SET NOCOUNT OFF

> </cfquery>

the identity will be returned in InsertThenSelect.New_ID

------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to