Hello
so far I got this
SELECT iSchoolCode ,
iSchoolYearCode,
dtCalendarDate ,
ROW_NUMBER() OVER ( ORDER BY dtCalendarDate ) RowNum
FROM #x1
WHERE iCalendarDayId IS NOT NULL
UNION ALL
SELECT iSchoolCode ,
iSchoolYearCode,
dtCalendarDate ,
NULL RowNum
FROM #x1
WHERE iCalendarDayId IS NULL
order by dtCalendarDate
if someone has better way to do please let me know
Thanks