Click here to Skip to main content
15,922,533 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi,

SQL
DECLARE @Product TABLE (Date_From Datetime, Date_To Datetime, Product_ID INT, WeekDay INT)


SQL
DECLARE @Beg varchar(50), @End varchar(50)
SET @one = 'Monday'
SET @two = 'Tuesday'
SET @three = 'Friday'


I want to update my @product table like below using sql query

date range is
20/03/2011 to 31/03/2011


Out put i need like below

2011-03-20  2011-03-20  101  
2011-03-21  2011-03-22  101 Mon,Tue
2011-03-23  2011-03-24  101
2011-03-25  2011-03-25  101 Fri
2011-03-26  2011-03-27  101 
2011-03-28  2011-03-29  101 Mon,Tue
2011-03-30  2011-03-31  101
Posted
Updated 23-Mar-11 19:39pm
v2

1 solution

Seems that you splitted the date range based on some logic. You mostly seem to have different dates in the output but sometimes (20th, 25th) you have the same date...

However may I suggest that you have a look at this article since it touches the issue you're working with: Using Table-Valued Functions in SQL Server[^]
 
Share this answer
 

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