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

你可能感兴趣的:(with)