You can use DATEPART to determine the day of the week.
It is best to use @@datefirst in the query, in case
its value changes.
-- Monday and Thursday only
where...
and DATEPART(dw,getdate())+@@datefirst in (2, 5)
-- Saturday and Sunday only
where...
and DATEPART(dw,getdate())+@@datefirst in (1, 7)
-- Steve Kass
-- Drew University
-- Ref: C64FDB90-0033-436B-A3BB-FC338FAB382A
[quoted text, click to view] Yachi wrote:
> devo passare all'SQL una stringa where che mi applichi delle modifiche
> in un range di data ma soltanto il martedi e il venerdì per esempio,
> opppure soltanto il giovedì e la domenica: Riporto un esempio:
>
> .....
> .....
> .....
> WHERE DATA BETWEEN 'Datainizio' AND 'DataFine' AND
> ..............................
>
> come gli passo dopo l'AND i giorni della settimana?
> In VB posso distinguere i giorni con Weekbday ma mi serve un consiglio
> per completare la clausola where.
>
> Thanks!!!!