日期:2014-05-17 浏览次数:20508 次
DECLARE @Dt VARCHAR(8)
SET @Dt='201212'
;WITH Cte
AS
(
SELECT CAST(@Dt+'01' AS DATEtime) AS dd
UNION ALL
SELECT dd+1 FROM Cte WHERE dd<DATEADD(mm,1,@Dt+'01')-1
)
SELECT TOP 8 * FROM Cte AS a
--WHERE EXISTS(SELECT 1 FROM [排除日期表] WHERE [排除日期]=a.dd)
ORDER BY NEWID()