我是新来的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
非常感谢你们的支持,多谢你的支持