• Make a table...

    CREATE TABLE [Daylightsavings](

    [PK_dst_key] [int] IDENTITY(1,1) NOT NULL,

    [dst_year] [int] NULL,

    [dst_begin] [date] NULL,

    [dst_end] [date] NULL,

    [dst_diff] [int] NULL,

    PRIMARY KEY CLUSTERED

    (

    [PK_dst_key] ASC

    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

    ) ON [PRIMARY]

    INSERT the daylight savings start and stop times plus the offset to use.

    insert into Daylightsavings

    (dst_year,dst_begin,dst_end,dst_diff)

    values

    (1980,'1980-04-27','1980-10-26',1),

    (1981,'1981-04-26','1981-10-25',1),

    (1982,'1982-04-25','1982-10-31',1),

    (1983,'1983-04-24','1983-10-30',1),

    (1984,'1984-04-29','1984-10-28',1),

    (1985,'1985-04-28','1985-10-27',1),

    (1986,'1986-04-27','1986-10-26',1),

    (1987,'1987-04-05','1987-10-25',1),

    (1988,'1988-04-03','1988-10-30',1),

    (1989,'1989-04-02','1989-10-29',1),

    (1990,'1990-04-01','1990-10-28',1),

    (1991,'1991-04-07','1991-10-27',1),

    (1992,'1992-04-05','1992-10-25',1),

    (1993,'1993-04-04','1993-10-31',1),

    (1994,'1994-04-03','1994-10-30',1),

    (1995,'1995-04-02','1995-10-29',1),

    (1996,'1996-04-07','1996-10-27',1),

    (1997,'1997-04-06','1997-10-26',1),

    (1998,'1998-04-05','1998-10-25',1),

    (1999,'1999-04-04','1999-10-31',1),

    (2000,'2000-04-02','2000-10-29',1),

    (2001,'2001-04-01','2001-10-28',1),

    (2002,'2002-04-07','2002-10-27',1),

    (2003,'2003-04-06','2003-10-26',1),

    (2004,'2004-04-04','2004-10-31',1),

    (2005,'2005-04-03','2005-10-30',1),

    (2006,'2006-04-02','2006-10-29',1),

    (2007,'2007-03-11','2007-11-04',1),

    (2008,'2008-03-09','2008-11-02',1),

    (2009,'2009-03-08','2009-11-01',1),

    (2010,'2010-03-14','2010-11-07',1),

    (2011,'2011-03-13','2011-11-06',1),

    (2012,'2012-03-11','2012-11-04',1),

    (2013,'2013-03-10','2013-11-03',1),

    (2014,'2014-03-09','2014-11-02',1),

    (2015,'2015-03-08','2015-11-01',1),

    (2016,'2016-03-13','2016-11-06',1),

    (2017,'2017-03-12','2017-11-05',1),

    (2018,'2018-03-11','2018-11-04',1),

    (2019,'2019-03-10','2019-11-03',1),

    (2020,'2020-03-08','2020-11-01',1),

    (2021,'2021-03-14','2021-11-07',1),

    (2022,'2022-03-13','2022-11-06',1),

    (2023,'2023-03-12','2023-11-05',1),

    (2024,'2024-03-10','2024-11-03',1),

    (2025,'2025-03-09','2025-11-02',1)

    Now JOIN to this table

    LEFT JOIN Daylightsavings dst ON

    <somedatevalue> between dst.begin and dst.end

    Then use isnull

    somedatevalue = dateadd(hh,isnull(dst.dst_diff,0),somedatevalue)



    --Mark Tassin
    MCITP - SQL Server DBA
    Proud member of the Anti-RBAR alliance.
    For help with Performance click this link[/url]
    For tips on how to post your problems[/url]