>
> Yup, this is a unique situation, it's a new application on top of an old
> database built in Pervasive SQL. The Primary key holds ID numbers that
> aren't auto generated.


I think I see the situation and you're approach is valid but long winded ;).
You can insert a record with a new ID with one SQL statement (and select the
ID, should you need it, with another). Lets say your table has two columns,
ID(int) and Title(varchar 50):

<cfquery name="qry_newThing" datasource="#request.dsn#">
    INSERT INTO thing (ID,Title)
    SELECT Max(ID) + 1, <cfqueryparam cfsqltype="cf_sql_varchar"
value="#newTitle#" maxlength="50">
    FROM thing

 <!--- then select the id for reference if you like --->
   SELECT Max(ID) as ID FROM thing
</cfquery>

<!--- redundant line of code but you get the point: --->
<cfset myNewThingID = qry_newThing.ID>

Dominic


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:295192
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to