Hmmm there is something funky going on. Even if I do this CF say "Element JOBTICKETID is undefined in GETJOBTICKETID."
<cfquery datasource="#application.dsn#" name="getJobTicketID"> SELECT MAX(JobTicketID) FROM JobTicket </cfquery> <cfoutput>#getJobTicketID.JobTicketID#</cfoutput> I will poke around and see what is going on. > -----Original Message----- > From: Chad Gray [mailto:[email protected]] > Sent: Tuesday, December 15, 2009 2:50 PM > To: cf-talk > Subject: RE: copy from table to table > > > 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. > > <cfquery datasource="#application.dsn#" name="insertTicket"> > INSERT INTO JobTicket (JobNum, DateCreated) > SELECT JobNum, #NOW()# > FROM JobTicket > WHERE JobTicketID = <cfqueryparam cfsqltype="cf_sql_integer" > value="#URL.JobTicketID#"> > ;SELECT SCOPE_IDENTITY() AS JobTicketID FROM JobTicket > </cfquery> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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:329164 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

