50% 레코드 함수

3115 단어 함수
ALTER FUNCTION [dbo].[fu_GetCaption](@Stage nvarchar(50)

,@T_stage_weeks int

,@S_stage_months int

,@RowNum int -- 

)

RETURNS nvarchar(260)

AS

BEGIN

Declare @caption nvarchar(260)=''

SELECT @caption=caption

FROM(SELECT T_stage_weeks

,S_stage_months

,caption

,ROW_NUMBER()OVER(ORDER BY Id)rn

FROM XXX 

WHERE Stage = @Stage

AND T_stage_weeks = @T_stage_weeks

AND S_stage_months = @S_stage_months)t

WHERE t.rn % 2 = @RowNum % 2



return @caption

END

좋은 웹페이지 즐겨찾기