Sql - With .. AS

 WITH q AS
        (
        SELECT  GETDATE() AS datum
        UNION ALL
        SELECT  datum + 1
        FROM    q
        WHERE datum + 1 < GETDATE() + 15
        )
    SELECT  CONVERT(NVARCHAR, DATEADD(dd, DATEDIFF(dd, 0, datum), 0), 103) AS MyDate
    FROM    q


   WITH q AS
        (
        SELECT  1 AS num
        UNION ALL
        SELECT  num + 1
        FROM    q
        WHERE num < 15
        )
    SELECT  * FROM    q


 WITH q AS
        (
        SELECT  0 AS num
        UNION ALL
        SELECT  num + 1
        FROM    q
        WHERE num <= 26
        )
        SELECT CHAR(num + 65) FROM    q
posted @ 2014-05-12 11:00  Kong, Star  阅读(162)  评论(0编辑  收藏  举报