Click here to Skip to main content
15,889,992 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
i want to check the every saturday and sunday of the month with the help of sql server
Posted
Comments
King Fisher 26-Jun-14 8:10am    
got solved or not?

SQL
DECLARE @DesiredDate date='2014-06-28'
SELECT CASE WHEN UPPER(DATENAME(dw, @DesiredDate)) = 'SUNDAY' OR UPPER(DATENAME(dw, @DesiredDate)) = 'SATURDAY'
THEN
    'YES'
ELSe
    'NO'
END
 
Share this answer
 
The below query gives you the name of the day [eg: if I give @date as today it will return "Tuesday"]
SQL
SELECT DATENAME(weekday,@date) AS 'Weekday' 


Hope this helps!

Regards,
Dinesh Kumar.V.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900