At 04:07 PM 9/15/2003 -0400, you wrote:
>Is there a way of doing an insert and a select on the data that was just
>inserted as a single operation inside a CFQUERY tag? Not in an SP, but as
>straight SQL.
>If not, I'll have to do the transaction, insert, select thing. I'm just 
>looking
>for the best option.

I know you can extract the newly created identity ID field value...

<cfquery name="yourinsertqueryname">
set nocount on
(your insert query)
select NewID (or whatever var you want) = @@IDENTITY
set nocount off
</cfquery>

then you can get that ID as #yourinsertqueryname.NewID#.

As far as the rest of the data, chances are you could get at it the same 
way, but instead of @@IDENTITY, use the fieldname... not sure if you'd need 
any sort of code-like chars in front though.

Aside from the identity field, you're doing a straight INSERT so you should 
already have the rest of the data handy, should you not? 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/lists.cfm?link=t:6
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:6
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=<:emailid:>.<:userid:>.<:listid:>

Get the mailserver that powers this list at 
http://www.coolfusion.com

                        

Reply via email to