Changing table data

  • jamesstirling01

    Mr or Mrs. 500

    Points: 562


    I have a table name 'Time Reported' and the format of the data is :

    1899-12-30 09:12:32.000

    There are 29602 rows of data, this was imported from a old Access database i would like to run a SQL query to remove the 1899-12-30 & the .000 and leave the 09:12:32

    Can anyone assist with a SQL query that will achive this.

    Cheers James

  • John Mitchell-245523

    SSC Guru

    Points: 148771

    DECLARE @TimeReported datetime = '1899-12-30 09:12:32.000';
    DECLARE @NewTime time;
    SET @NewTime = CAST(@TimeReported AS time);
    SELECT @NewTime;


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

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