我是 sql 编程新手;尝试开发此功能以从视图中获取具有特定访问次数的客户行:
ALTER FUNCTION [dbo].[fn_NumberOfVisit]
(
@nv int
)
RETURNS varchar(500)
AS
BEGIN
DECLARE @ret varchar(500)
select *
from (
select
*,
rn = row_number() over (partition by ClientId order by VisitId)
from
Visit
) activityWithRn
inner join vw_MasterView on vw_MasterView.VisitId = activityWithRn.VisitId
where activityWithRn.rn =@nv
RETURN @ret
END
我收到以下错误:
Select statements included within a function cannot return data to a client
感谢您的支持。提前致谢。