SQLServer里用户自定义函数写在哪
2015-05-05
drop FUNCTION [dbo].[jzf_Get_IDNO]
go
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date, ,>
-- Description: <Description, ,>
-- =============================================
create FUNCTION [dbo].[jzf_Get_IDNO]
(
-- Add the parameters for the function here
@ApartID nvarchar(40)
)
RETURNS nvarchar(40)
AS
BEGIN
-- Declare the return variable here
DECLARE @str nvarchar(40)
set @str=N'未查到'
-- Add the T-SQL statements to compute the return value here
SELECT @str=Isnull(IDNO,N'未定义') from mytable where objectid=@ApartID
-- Return the result of the function
RETURN @str
END
---------------------结果显示在,上述函数是标量值函数:
广告 您可能关注的内容 |