Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 convert Monday,tuesday to .....date based on colum

Author  Topic 

Akshaya Pargunan
Starting Member

10 Posts

Posted - 2011-10-10 : 08:27:40
I have table like below
Monday Tuesday Wednesday Thursday Friday Saturday Sunday WeekEndDate
------ ------- --------- -------- ------ -------- ------ -----------
2 3 2 5 5 8 0 02/10/2011
0 3 7 1 0 2 4 09/10/2011
3 0 2 0 5 0 6 16/10/2011
2 3 0 1 0 8 9 23/10/2011
1 6 2 4 0 3 0 30/10/2011

Weekenddate has sunday's date,the row has one week date from monday to sunday.
I have two inputs
fromdate = 06/10/201
todate = 20/10/2011

i want to return rows like
06/10/2011 07/10/2011 08/10/2011 09/10/2011 ....20/10/2011
--------- ---------- ---------- --------- ----------
1 0 2 4 ....1

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2011-10-10 : 08:40:36
duplicate
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=166463

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-10-10 : 08:42:59
use PIVOT
http://sqlblogcasts.com/blogs/madhivanan/archive/2008/08/27/dynamic-pivot-in-sql-server-2005.aspx

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -