sqlserver和mysql存储过程的转化


下面是sqlserver存储过程和mysql存储过程的转化:

SQL SERVER MYSQL
GO 去掉GO
create procedure之后的AS 去掉AS
SET QUOTED_IDENTIFIER ON、SET ANSI_NULLS ON 去掉这两句
使用参数带@符号 使用参数前去掉@
create procedure()中的传入符号@参数 @参数换成IN 参数
sqlserver参数直接赋值 参数赋值写到BEGIN下面的set语句
if begin......end else bgin......end if then......else......end if
update a set ... from a,b update a,b set...
convert cast()
return语句

label:BEGIN

LEAVE label; # 退出存储过程

调用存储过程,可以直接EXEC CALL
[dbo]. 可以直接去除
select a=b赋值 select a into b
ISNULL(expr1,expr2) IFNULL(expr1,expr2)
   
   
   
   
   

相关