Thanks everyone!

I remember having problems with some database with INSERT INTO.  Access maybe?  
I can't remember.

I will check out the CF8 result structure... I did not know is existed!

Thanks!

> -----Original Message-----
> From: Azadi Saryev [mailto:az...@sabai-dee.com]
> Sent: Tuesday, March 17, 2009 2:02 PM
> To: cf-talk
> Subject: Re: MySQL and CF LAST_INSERT_ID()
> 
> 
> well...
> 
> first, the proper syntax for an INSERT query starts with INSERT INTO,
> not just INSERT ...
> 
> second, by default, multiple statements are NOT supported in mysql db -
> do you have multiple statements enabled for this dsn in mysql?
> 
> third: cf8 has a cfquery attribute RESULT, which, when utilised
> properly, can return the new generated PK. check the cfml reference for
> details. if you do not have one - download a free pdf from adobe.com.
> for mysql db the variable is GENERATED_KEY...
> 
> 
> Azadi Saryev
> Sabai-dee.com
> http://www.sabai-dee.com/
> 
> 
> 
> Chad Gray wrote:
> > I am trying to use the MySQL function LAST_INSERT_ID() in a CFquery tag
> and get this error.
> >
> > Error Executing Database Query.
> > You have an error in your SQL syntax; check the manual that corresponds
> to your MySQL server version for the right syntax to use near '; SELECT
> LAST_INSERT_ID() AS UserID' at line 4
> >
> > INSERT users (Foo, Foo1, Foo2)
> > VALUES ('test', 'test', 'test');
> > SELECT LAST_INSERT_ID() AS UserID;
> >
> > If I run this query in MySQL Front it works fine.  It returns the last
> UserID.  If I run this code inside of CFQuery I get the error.
> >
> > Any ideas why it is not working in a CFQUery tag?
> >
> >
> >
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320595
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to