If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > syntax problem

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-16-08, 05:47
shwetacparikh shwetacparikh is offline
Registered User
 
Join Date: Dec 2008
Posts: 1
syntax problem

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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On