狐的传说
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)ASBEGIN-- Declare the return variable hereDECLARE @str nvarchar(40)set @str=N'未查到'-- Add the T-SQL statements to compute the return value hereSELECT @str=Isnull(IDNO,N'未定义') from mytable where objectid=@ApartID-- Return the result of the functionRETURN @strEND---------------------结果显示在,上述函数是标量值函数: