Pading a datetime value

  • I have datetime values in two columns startDate and endDate.

    e.g.

    startDate endDate

    2000-10-18 00:00:00.0002001-10-25 00:00:00.000

    1997-03-04 00:00:00.0001998-01-27 00:00:00.000

    Now i am required that month and day of value in startdate column should be changed to 07-01

    and month and day of value in enddate column should be changed to 06-30.

    What may be the efficient way out for this, as i have to apply it on a large number of records.

    DBDigger Microsoft Data Platform Consultancy.

  • AShehzad (9/11/2008)


    I have datetime values in two columns startDate and endDate.

    e.g.

    startDate endDate

    2000-10-18 00:00:00.0002001-10-25 00:00:00.000

    1997-03-04 00:00:00.0001998-01-27 00:00:00.000

    Now i am required that month and day of value in startdate column should be changed to 07-01

    and month and day of value in enddate column should be changed to 06-30.

    What may be the efficient way out for this, as i have to apply it on a large number of records.

    In such a case, you will have to pick the year from the startDate and endDate, and create a date time string cast it back to datetime and update it.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply