dear friends

i m new in mysql nd i have to convert all my stored procedured from sqlserver 2005 to my sql

but i got an error when i tried to convert it.

for ex my stored proc in sqlserver 2005 is

ALTER PROCEDURE [dbo].[sp_dbtransaction]

(
@tbname nvarchar(max)=null,
@tbtemp nvarchar(max)=null,
@tbdetail nvarchar(max)=null,
@whereCondition nvarchar(max) = null,
@fields nvarchar(max)=null,
@values nvarchar(max)=null,
@detailfields nvarchar(max) =null,
@tempfields nvarchar(max)=null,
@maxvalue nvarchar(max)=null,
@tempquery nvarchar(max) = null,
@flag int = 0
)
as
begin
declare @insertcommand nvarchar(max),
@selectcommand nvarchar(max),
@updatecommand nvarchar(max),
@deletecommand nvarchar(max),
@insertcommand1 nvarchar(max),
@maxid nvarchar(max),
@selecttemp nvarchar(max),
@temp nvarchar(max),
@selectmaxtemp nvarchar(max),
@temptbname nvarchar(max)

begin transaction
------------------------------------------------------------
if @flag = 0
-------------------------------------------------------------------
begin
if @whereCondition is null
begin
if @fields is null
begin
set @selectcommand = 'select * from '+ ' ' + @tbname
exec SP_EXECUTESQL @selectcommand
end
else
begin
set @selectcommand = 'select ' + @fields +' from '+ ' ' + @tbname
exec SP_EXECUTESQL @selectcommand
end
end
else
begin
if @fields is null /*for selected city and state */
begin
set @selectcommand = 'select * from' +' ' + @tbname +' ' + 'where ' + @whereCondition
exec SP_EXECUTESQL @selectcommand
end
else
begin
set @selectcommand = 'select ' + @fields + ' from' +' ' + @tbname +' ' + 'where ' + @whereCondition
exec SP_EXECUTESQL @selectcommand
end
end
end
--------------------------------------------------------------------
if @flag = 1
----------------------------------------------------------------------
begin
query
end
----------------------------------------------------------------------
i dont know how do i convert this in mysql?
can anyone help me to figure this out?
thanks.
shweta