私は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
よろしくお願いします。前もって感謝します。