I'm really not sure if MySQL would support it though - I'm fairly sure it
doesn't have transactions, and I don't know whether it support SP-like
statements either...

David Cummins

paul smith wrote:
> 
> You could also use the small table (MAX_ID_orgs below) method Microsoft
> recommended for SQL6 or so (forget the Article number):
> 
> <CFQUERY NAME="AddRow" DATASOURCE="" PASSWORD="" USERNAME="">
> BEGIN TRANSACTION
> UPDATE MAX_ID_orgs SET MAX_ID_org = MAX_ID_org + 1
> DECLARE @MAX INT
> SELECT @MAX = MAX_ID_org FROM MAX_ID_orgs
> INSERT INTO Orgs
> (ID, Class, Contact, org_name, org_add, City, State, Zip, Telephone, Credit)
> VALUES
> (@MAX, #Session.ClassNumber#, '#Form.Contact#', '#Form.org_name#',
> '#Form.org_add#', '#Form.City#', 'CA', '#Form.Zip#', '#Form.Telephone#',
> '#Session.Credit#')
> COMMIT TRANSACTION
> </CFQUERY>
> 
> At 09:37 AM 12/7/00 +1300, you wrote:
> >The most reliable way as far as I can see is to select the max id using the
> >exact criteria. I mean, come on, how likely is a collision?
> >
> >David Cummins

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to