Yes. You're correct. My Bad. TSQL. That's probably why I should just turn off email when I'm busy on something else.
Robert B. Harrison Director of Interactive Services Austin & Williams 125 Kennedy Drive, Suite 100 Hauppauge NY 11788 P : 631.231.6600 Ext. 119 F : 631.434.7022 http://www.austin-williams.com Great advertising can't be either/or. It must be &. Plug in to our blog: A&W Unplugged http://www.austin-williams.com/unplugged -----Original Message----- From: Dave Watts [mailto:[email protected]] Sent: Tuesday, September 29, 2009 4:00 PM To: cf-talk Subject: Re: MySQL Auto Increment Field > You can also do this using SQL. Sure this works with MS SQL, not 100% sure > about mySQL but it's standard SQL, so it should work. > > <cfquery name="putData" datasource="#dsn#"> > SET NOCOUNT ON > INSERT INTO my_table (my_field1, my_field2) > VALUES ('#trim(value_field1)#', ('#trim(value_field2)#') > SELECT @@Identity AS newId > SET NOCOUNT OFF ; > </cfquery> > > <cfoutput>The Generated ID is: #putData.newId#</cfoutput> The @@IDENTITY global variable is not standard SQL. It's specific to T-SQL. So is SET NOCOUNT ON|OFF. Of the four SQL statements you've listed, one is standard SQL. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ Fig Leaf Software provides the highest caliber vendor-authorized instruction at our training centers in Washington DC, Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your location. Visit http://training.figleaf.com/ for ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:326757 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

