Hi i have one table in sql server and i have added one bit for each week day. I have one property that’s a date and i want to update all the table updating the bit depending of the dayofWeek of this date. I have read something about t-sql (datepart) but i dont know how can I do it, somebody can help me a little?
Here is a screenshot of my table
http://i.imgbox.com/adpsLL0D.jpg
For instance, in the firsts three records (2012-11-04, the last month, sunday) i want to update updating “prt_Dom” to 1.
Thanks.
I’m not completely sure what you’re trying to do, but perhaps something like this?
If your logic is really this simple then you don’t need the
prt_%columns at all, because you can always derive the bit values fromprt_fechaon demand. But I’m guessing that you’re setting defaults here that you may override later, in which case the table would make sense.And when working with dates be careful with culture-specific settings such as
SET DATEFIRSTandSET LANGUAGE.