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

  • SEARCH
  • Home
  • 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 554927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:45:43+00:00 2026-05-13T11:45:43+00:00

I have a table name Overtime Hours which have the following columns Ot_ID, Shift_Date,

  • 0

I have a table name Overtime Hours which have the following columns
Ot_ID, Shift_Date, Employee_ID, Hours.

What I need to do is insert a set of values in these tables on the 1st date of every month, automatically.

for example, I need to add values(‘1/1/2010’,12345,4.6) for january,
values(‘2/1/2010’,12345,4.6) for february and so on for the whole year.

This addition has to be done so a certain list of employees only and the Hours value is constant for every month.
I am working on MS SQL Server 2000 in the backend. and visual studio, Winforms on C sharp in the front end.

  • 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-05-13T11:45:44+00:00Added an answer on May 13, 2026 at 11:45 am

    You can create a list of months using a common table expression. Use cross join to generate a row for each employee for each month, and insert that into the hours table.

    Some example code, with table variables:

    declare @hourtable table (
        ot_id int identity(1,1),
        shift_date datetime,
        employee_id int,
        hours float)
    
    declare @employees table (
        employee_id int
    )   
    
    insert into @employees select 1
    insert into @employees select 2
    
    ;with months as (
        select cast('2009-01-01' as datetime) as month
        union all
        select dateadd(m,1,month)
        from months
        where month < '2009-12-01'  
    )
    insert into @hourtable
    (shift_date, employee_id, hours)
    select m.month, e.employee_id, 1.23
    from months m
    cross join @employees e
    
    select * from @hourtable
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have table with following details Table name EMPLOYEE and columns EMPID (PK smallint
Let's say I have the following table: CustomerID ParentID Name ========== ======== ==== 1
I have a table which have an integer coloumn. Let table name is Table1
If I have a table like this: CREATE TABLE sizes ( name ENUM('small', 'medium',
I have table with 50 entries (users with such details like Name Surname Location
I have a script that takes a table name and generates a control file
Let's say I have a table like this: name | score_a | score_b -----+---------+--------
I have the following code: ListBox.DataSource = DataSet.Tables(table_name).Select(some_criteria = match) ListBox.DisplayMember = name The
Let's say I have the following objects: squirrel_table - name - country_of_origin - id
We have a table, name 'employeeReg' with fields employeeNo | employeeName | Registered_on Here

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.