[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.sqlserver.programming

Looping through table based on time w/ DateAdd

Scott Hedrick

3/15/2007 9:55:00 PM

I need to walk through a table with many thousands of rows summarizing data
by minute. If I use the DateAdd function to go to the next minute, I do not
get the proper results for 3/11 when the time changed. I have since
discovered that DateAdd is not DST aware even though SQL Server books online
NEVER mention that little fact.

Any suggestion on how to accomplish this without hard coding specific dates
and times?
--
Thanks,
Scott
2 Answers

--CELKO--

3/15/2007 10:27:00 PM

0

>> . If I use the DateAdd function to go to the next minute, I do not get the proper results for 3/11 when the time changed. I have since discovered that DateAdd is not DST aware even though SQL Server books online NEVER mention that little fact. <<

This is why Standard SQL uses only UTC times and then converts to
local lawful time via schema information tables. Can you do an UPDATE
on the schema's temporal columns, then add a VIEW to show your local
time?

Also you can construct a table of datetime ranges and use a BETWEEN
predicate to put an event into a time slot identified in some way.

Scott Hedrick

3/19/2007 7:55:00 PM

0

Thanks for the suggestions. I was starting to go that direction anyway and
you've confirmed that approach.
--
Thanks,
Scott