t-sql bug fixed

2007-07-22 @ 11:55#

i fixed a gnarly t-sql bug this am that was messing up a couple of my archive queries. the ?thisweek and ?lastweek queries worked fine most of the time, but occasionally i got no rows back even when i *knew* data was available. turns out that these two queries failed only when the weekday was 'sunday'[ah-ha!].

i dug into t-sql and figured out i can check for the day of the week using DATENAME(wk,@thisdate) and, if it returns 'sunday', alter my query accordingly.

what i don't know about t-sql date-handling functions could fill volumes - yeah for the internet and help files!

code