Gå til innhold

Kjapp liten test her


AnBa

Anbefalte innlegg

Videoannonse
Annonse

Vilkårlig kode fra pastebin.com.

select 
   datepart (ww,dateadd(d,day_number,convert(datetime,'2009-01-01',102))) as week_number
 , dateadd(d,day_number,convert(datetime,'2009-01-01',102)) as data_licz
--  , datepart (dw,dateadd(d,day_number,convert(datetime,'2009-01-01',102))) as day_week_number
 , dateadd(d,day_number + (7 - datepart (dw,dateadd(d,day_number,convert(datetime,'2009-01-01',102)))),convert(datetime,'2009-01-01',102)) as data_licz_e

from (

select l, (ROW_NUMBER ( )  over (ORDER BY l DESC)) - 1 as day_number  from (

SELECT  top 366   derivedtbl_2.Expr1 AS l
FROM         (SELECT     1 AS Expr1
                      UNION ALL
                      SELECT     1 AS Expr1
                      UNION ALL
                      SELECT     1 AS Expr1
                      UNION ALL
                      SELECT     1 AS Expr1
                      UNION ALL
                      SELECT     1 AS Expr1
                      UNION ALL
                      SELECT     1 AS Expr1
                      UNION ALL
                      SELECT     1 AS Expr1
                      UNION ALL
                      SELECT     1 AS Expr1
                      UNION ALL
                      SELECT     1 AS Expr1
                      UNION ALL
                      SELECT     1 AS Expr1) AS derivedtbl_1 CROSS JOIN
                         (SELECT     1 AS Expr1
                           UNION ALL
                           SELECT     1 AS Expr1
                           UNION ALL
                           SELECT     1 AS Expr1
                           UNION ALL
                           SELECT     1 AS Expr1
                           UNION ALL
                           SELECT     1 AS Expr1
                           UNION ALL
                           SELECT     1 AS Expr1
                           UNION ALL
                           SELECT     1 AS Expr1
                           UNION ALL
                           SELECT     1 AS Expr1
                           UNION ALL
                           SELECT     1 AS Expr1
                           UNION ALL
                           SELECT     1 AS Expr1) AS derivedtbl_2 CROSS JOIN
                         (SELECT     1 AS Expr1
                           UNION ALL
                           SELECT     1 AS Expr1
                           UNION ALL
                           SELECT     1 AS Expr1
                           UNION ALL
                           SELECT     1 AS Expr1) AS derivedtbl_3 ) as t
) as tt

where datepart (dw,dateadd(d,day_number,convert(datetime,'2009-01-01',102))) = 1 or day_number = 1

Lenke til kommentar
Gjest
Dette emnet er stengt for flere svar.
  • Hvem er aktive   0 medlemmer

    • Ingen innloggede medlemmer aktive
×
×
  • Opprett ny...