3 questions about unique identifiers and cftransaction
I need to insert a row into table1 that has a unique identifier made by SQL.
Immediately after that, I need to insert a row into table2 that has the unique id from table1 in it. Table2 also has a unique id made for its rows by SQL.
Immediately after that, I need to insert a row into table3 that has the unique ids from table1 and table2 in it. Table3 doesn't have its own unique id.
This will happen thousands of times a day along with updates an deletes. This is a new way of doing things for me.
QUESTION 1: Is this the way to do it ?
<cftransaction name="firsttry">
<cfquery name="queryname1" result="resultname1" datasource="datasourcename">
insert into table1 (...) values (...)
<cfquery>
<cfset uniqueid1=resultname1.IDENTITYCOL>
<cfquery name="queryname2" result="resultname2" datasource="datasourcename">
insert into table2 (...uniqueid1...) values (...#uniqueid1#...)
<cfquery>
<cfset uniqueid2=resultname2.IDENTITYCOL>
<cfquery name="queryname3" datasource="datasourcename">
insert into table3 (...uniqueid1,uniqueid2...) values (...#uniqueid1#,#uniqueid2#...)
<cfquery>
</cftransaction>
QUESTION 2: Are there any problems that come with using the automatically made unique ids or are they very dependable ?
QUESTION 3: Are there any problems that come with using cfttransaction or is it very dependable ?
