Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

SQL Syntax

Avatar of jknj72
jknj72 asked on
Microsoft SQL ServerSQL
6 Comments1 Solution140 ViewsLast Modified:
I have a param I pass in that is a number representation of the day of Week. It will be either 1 - 5 for Mon - Friday

Its in my Where clause so I am trying to set it to the day of week

heres what I got....

and DATENAME(weekday, wid.WorkDate) = 
(CASE WHEN @WeekDay = 1 THEN 'Monday'  
OR CASE WHEN @WeekDay = 2 THEN 'Tuesday'  
OR CASE WHEN @WeekDay = 3 THEN 'Wednesday'  
OR CASE WHEN @WeekDay = 4 THEN 'Thursday'  
OR CASE WHEN @WeekDay = 5 THEN 'Friday' ) 

I know I can declare a variable and set the day that way but I would like to figure out how to do it this way!!

Thanks