[SQL]存储过程的使用

1.在mssql创建存储过程,在db->存储过程->新建存储过程(右键)

 

CREATE PROCEDURE user_logon_check @username varchar(45),@userpsw varchar(45)
 AS
select * from users where UserName = @username and PasswordCode = @userpsw
return 10
GO

 

2.在mysql创建存储过程,使用Mysql Query Browser,在db->表名->Create New Procedure/Function(右键)

 

DELIMITER //
DROP PROCEDURE IF EXISTS `test`.`user_logon_check`//
CREATE PROCEDURE `user_logon_check`(in username varchar(45),IN userpsw varchar(45))
BEGIN
  SELECT * FROM test where name = username and psw = userpsw;
END//
DELIMITER ;
注意将 $$ -> //

你可能感兴趣的:(数据库)