I'm guessing you're talking about sequences. They're part of the standard for SQL but not supported by SQL Server 2000 (not sure about 2005). Oracle supports them and I assumed PostgreSQL would support them. I couldn't say if MySQL, DB2 or FoxPro support them. I know Access doesn't, and probably never will.
> I'm not sure about MySQL, but in Postgres you can select a > new identity > key /before/ you do an insert. The key is unique to you, > and can never > be used by anybody else (just like getting a new key when > you do an > insert). Then you can use that key for your insert and > any subsequent > queries. Much safer than Microsft's approach, where you > have to > scramble to safely get the key from a recent insert. >> -----Original Message----- >> From: Joelle Tegwen [mailto:[EMAIL PROTECTED] >> Sent: Tuesday, April 04, 2006 9:11 AM >> >> How would you to this in (say) MySQL? >> >> Munson, Jacob wrote: >> > Keep in mind that most other databases (besides SQL >> > Server) >> don't allow >> > you to send two queries with at once like this. It's >> > very insecure, >> > because of sql injection possibilities. But since you >> > guys are all >> > talking about MS SQL, this works fine. :) >> > >> >> Moreover, a better solution would be something like >> >> this >> >> (assuming SQL Server): >> >> >> >> <cftransaction> >> >> <cfquery name="qInsertData" >> >> datasource="#APPLICATION.dsn#"> >> >> INSERT INTO t_doctors (#ColNames#) >> >> VALUES >> >> (#preserveSingleQuotes(ColValues)#); >> >> SELECT SCOPE_IDENTITY() AS newpkey; >> >> </cfquery> >> >> </cftransaction> s. isaac dealey 434.293.6201 new epoch : isn't it time for a change? add features without fixtures with the onTap open source framework http://www.fusiontap.com http://coldfusion.sys-con.com/author/4806Dealey.htm ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:236928 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

