Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8700961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:17:18+00:00 2026-06-13T02:17:18+00:00

I have a table say Timesheet, which is having one week hour entry stored

  • 0

I have a table say Timesheet, which is having one week hour entry stored as a row. Eg:

ID  Start Date  Sun  Mon  Tue  Wed  Thu  Fri  Sat
-------------------------------------------------
1   14-Oct-2012  0    1    1    2    3    5    0

The start date is always Sunday’s date.
I need to export this data into multiple rows, one row for each date, based on input criteria.

For example, if the input criteria is: Date is between 15-Oct-2012 to 17-Oct-2012, my output should be something like:

Date   Hours
------------
15-Oct   1
16-Oct   1
17-Oct   2

I am using SQL Server 2000, please suggest me a way.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T02:17:19+00:00Added an answer on June 13, 2026 at 2:17 am

    SQL Server 2000, does not have an UNPIVOT function so you can use a UNION ALL to query this data and get it in the format that you want:

    select date, hours
    from
    (
      select id, startdate date, sun hours
      from yourtable
      union all
      select id, dateadd(dd, 1, startdate), mon
      from yourtable
      union all
      select id, dateadd(dd, 2, startdate), tue
      from yourtable
      union all
      select id, dateadd(dd, 3, startdate), wed
      from yourtable
      union all
      select id, dateadd(dd, 4, startdate), thu
      from yourtable
      union all
      select id, dateadd(dd, 5, startdate), fri
      from yourtable
      union all
      select id, dateadd(dd, 6, startdate), sat
      from yourtable
    ) x
    where date between '2012-10-15' and '2012-10-17'
    

    See SQL Fiddle With Demo

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table say Table-C which gets row data by dragging from Table-A
I am having one table say emp, in that i dont have any values.
I have a table say table1 which has 3 columns column1, column2 and column3
I have a table (lets say it has one column called 'colLanguage') that contains
I have a table say : id| AccID | Subject | Date 1 |
In SQL Server 2005, I have a table say tbl_Info. There I have one
i have a table say, Table1 and one more table say, ErrorTable1. ErrorTable1 is
I have two table say T1 and T2 and one column C is common
We have one table say table A we left join with table B. This
I have a table(say TableA) with the following schema A(int) B(int) D (varchar) C(date)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.