hey all....

I've got a simple table insert.  After I insert the data, I'd like to
select the primary key of the record that I just inserted.  Here's the
trick: we are using a SQL Server 7 database, and i'd like to take
advantage of the ability to select the @@identity value, all within the
same set of cfquery tags.

I've got the code below.  The SQL statements run just fine....but I am
unable to view the results of the last "select" statement.  It may well
be that CF does not know the value of my variable....or perhaps it
doesn't know how to handle the multiple recordset return...????

Does anyone know if what i'm trying to do is possible??

<code snippet>

<cfquery name="InsertThenSelect" datasource="my database">
declare @New_ID int

INSERT INTO My_Table (Data_Name, Data_Description)
VALUES ('Here's my data', 'Heres my description')

select @New_ID = @@identity
</cfquery>

Thanks for your time......

Brian

------------------------------------------------------------------------------
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