On Tue, Dec 15, 2009 at 2:50 PM, Chad Gray <[email protected]> wrote:

>
> That works great!
>
> How would I format a SCOPE_IDENTITY() around this type of query?  I tried
> this and I don't get the ID back out.  The SQL does not error but when I
> output #insertTicket.JobTicketID# CF says it is not defined.
>
>
Not sure what DB you are on but as example MSSQL 2005 and up, you can use
OUTPUT inserted.fieldName


> <cfquery datasource="#application.dsn#" name="insertTicket">
> INSERT INTO JobTicket (JobNum, DateCreated)
>
        OUTPUT inserted.JobTicketID

> SELECT JobNum, #NOW()#
> FROM JobTicket
> WHERE JobTicketID = <cfqueryparam cfsqltype="cf_sql_integer"
> value="#URL.JobTicketID#">
> </cfquery>
>
>

Casey


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:329167
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to