"Jeff" <EMAIL REMOVED> wrote:
> Sql Server has the automatic variable @@error, which if greater than 0 means
> the last sql statement failed. What is equivalent at MySql5?
No idea. Why do you need this? Declare a handler instead.
> A MySql5 stored procedure can have OUT parameter, but it can also have a
> RETURN parameter. Is there some guidelines on which to use?
If you have only one return value, you should return it with RETURN.
Otherwise you have to use OUT parameters.
> I've read in the MySql5 documentation that mysql_insert_id() returns the
> last inserted id. But do this mean the last inserted id in current
> transaction or is it
There are multiple ways to get the last generated AUTO_INCREMENT value.
mysql_insert_id() is answered by the client itself (using the buffered
result from the last query). LAST_INSERT_ID() is a SQL function that
uses the remembered value from the last AUTO_INCREMENTed column. This
is not the same! Check the manual:
http://dev.mysql.com/doc/refman/5.0/...unique-id.html http://dev.mysql.com/doc/refman/5.0/...insert-id.html http://dev.mysql.com/doc/refman/5.0/...increment.html
XL
--
Axel Schwenke, Support Engineer, MySQL AB
Online User Manual:
http://dev.mysql.com/doc/refman/5.0/en/
MySQL User Forums:
http://forums.mysql.com/