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
时间: 2024-11-09 17:10:50