MySQL Forums
Forum List  »  Microsoft SQL Server

converting stored procedure from SQL Server
Posted by: Les Stockton
Date: January 12, 2006 02:34PM

Here's a stored procedure that I'm trying to convert to work in MySQL.

Create Proc MyAddRecord ( @TblName varchar(50), @NewIDVal int OUTPUT ) AS EXECUTE('INSERT INTO [' + @TblName +

'] DEFAULT VALUES') SET @NewIDVal = @@IDENTITY


I have tried the following:

CREATE PROCEDURE `testcreate`.`MyAddRecord` (TblName varchar(50),OUT NewIDVal int)
BEGIN
EXECUTE(CONCAT('INSERT INTO [', TblName ,'] DEFAULT VALUES'));
SET NewIDVal = @@IDENTITY;
END

but it's still giving me an error, so I was wondering if someone can look at this and suggest changes that'll get it to work.

Options: ReplyQuote


Subject
Written By
Posted
converting stored procedure from SQL Server
January 12, 2006 02:34PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.