Click here to Skip to main content
15,887,477 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi experts
i want code for to pass multiple values in a single parameter then get the values.

for example

we take weekdays and offices. some offices works monday and tuesday, some offices may work all days and some offices works friday and tuesday

here my problem is how to get both friday and tuesday days working offices.. how to pass both values in a single parameter and how it call in sql storedprocedure..


please help me..


Thanks in advance
Posted
Comments
♥…ЯҠ…♥ 7-Feb-14 5:48am    
Could you more specific? give your table details with sample output that you want it from there.
NaniCh 7-Feb-14 7:58am    
i used two tables one is Weekdays and another one is Office table. both table relation is weekdayId. so offices working days is monday and tuesday only.. then we wnat to get offices in working for perticulars that days only.. how can i check

The best solution would be to pass begin and end workdays to your stored procedure and then in your stored procedure use those to determine your work week.
 
Share this answer
 
The questions is not clear. If you meant to ask how to pass multiple values in a parameter passed to SQL Server Stored Procedure, you can actually pass it as a bitfield and use bitwise AND operator (&) in T-SQL to get the value. Check this article[^] to know more.

If you meant to ask how to check for multiple values in a column, you can use the IN clause
SQL
SELECT * FROM MyTable WHERE DayOfWeek IN ('monday', 'thursday', 'friday')
 
Share this answer
 
Comments
NaniCh 7-Feb-14 7:55am    
I used This query.. here i get problem is there any one of week day is satisfy it getting results. i want exact output

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