Jesse,

BEGIN
 INSERT INTO Campers (FirstName, LastName, UserName, Password) VALUES
(cFirstName, cLastName, cUserName, cPassword) // ERROR RIGHT HERE.
 AddedID = LAST_INSERT_ID()
END;

First, there's a right parenthesis missing. Second, the expression

 AddedID = LAST_INSERT_ID()

will evaluate to 1, 0 or Null depending on whether AddedID = Last_Insert_Id() or whether either is Null---likely not what you intend. To assign a value inline, use the ':=' operator.

PB

------

Jesse Castleberry wrote:

I've got a stored procedure I'm trying to convert from MS SQL.  I've gotton
so far with it, but it's complaining about the INSERT command. It's a very
simple stored procedure, so it should easy to figure out, but I'm not
familiar with the MySQL Stored Procedure syntax.  If someone can point out
what I'm doing wrong here, I'd appreciate it:

CREATE Procedure sp_InsertNewCamper
(
in cFirstName NVarChar(30),
in cLastName NVarChar(30),
in cUserName NVarChar(30),
in cPassword NVarChar(30),
out AddedID Int
)
BEGIN
 INSERT INTO Campers (FirstName, LastName, UserName, Password) VALUES
(cFirstName, cLastName, cUserName, cPassword) // ERROR RIGHT HERE.
 AddedID = LAST_INSERT_ID()
END;

It complains about the INSERT INTO command where I've indicated above, with
a Syntac error.  What is the proper syntax for this?

Thanks,
Jesse




--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.362 / Virus Database: 267.12.8/162 - Release Date: 11/5/2005


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to