ALTER FUNCTION [dbo].[fu_GetCaption](@Stage nvarchar(50),@T_stage_weeks int,@S_stage_months int,@RowNum int --第几行)RETURNS nvarchar(260)ASBEGINDeclare @caption nvarchar(260)=''SELECT @caption=captionFROM(SELECT T_stage_weeks,S_stage_months,caption,ROW_NUMBER()OVER(ORDER BY Id)rnFROM XXX WHERE Stage = @StageAND T_stage_weeks = @T_stage_weeksAND S_stage_months = @S_stage_months)tWHERE t.rn % 2 = @RowNum % 2return @captionEND