That's such a bad idea. Not only does max() need to scan the whole table to find the desired value (for each INSERT), you will also - sooner or later - get collisions. Never ever use such a function to create primary keys. It will lead to problems. Use generators - they are the only transaction-safe way to get unique IDs.
Regards, Alex > -----Ursprüngliche Nachricht----- > Von: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] > Im Auftrag von Balla Imre > Gesendet: Freitag, 18. August 2006 15:38 > An: For users and developers of the Firebird .NET providers > Betreff: Re: [Firebird-net-provider] DDEX stored procedure problem > > I forgot about your second question. :-) > > If I don't use difficult generators, then I don't use them at all. > > I mean if I want to get an autoincrement number for every > record, I personally prefer to use something like: > insert into table (id, field1, field2) select > coalesce(max(id) + 1, 1), @field1, @field2 from table and > then add parameter values. > > Much simplier and easier. But only works after 1.5 > > Imre > > -------------------------------------------------------------- > ----------- > Using Tomcat but need to do more? Need to support web > services, security? > Get stuff done quickly with pre-integrated technology to make > your job easier Download IBM WebSphere Application Server > v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057& > dat=121642 > _______________________________________________ > Firebird-net-provider mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/firebird-net-provider > ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Firebird-net-provider mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/firebird-net-provider
