创建有返回值与有参数的函数
求教:
CREATE FUNCTION my_function(@user_Name varchar(128),@password int(6))
returns varchar(255)--设置返回值,记住是returns 而不是return
AS
BEGIN
DECLARE @result varchar(5)
DECLARE @fagle varchar(5)
SET @result = select users.user_Name from USERS as users where users.user_Name = @user_Name and users.password = @password
IF @result = ''
BEGIN
SET @fagle = 'NO'
END
ELSE
BEGIN
SET @falge = 'YES'
END
return @result --返回结果
END
select附近有错误,求大侠讲解
原文 http://blog.csdn.net/zhdd1234/article/details/4734789
------解决方案--------------------select @result=users.user_Name from USERS as users where users.user_Name = @user_Name and users.password = @password
------解决方案--------------------
SET @result = (select users.user_Name from USERS as users where users.user_Name = @user_Name and users.password = @password)