Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. How do I to mass update date and time?

How do I to mass update date and time?

Scheduled Pinned Locked Moved Database
databasehelpquestiontutorialannouncement
5 Posts 3 Posters 4 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Justiin1265
    wrote on last edited by
    #1

    Hi, I have to query an update for date and time. I know how to update the date alone, but I am having trouble with adding the time to the function. Right now, as it stands, it reads 4/20/2011 1:32:07 PM. I need the dock_date field to read 4/21/2011 7:00:00 AM. When I add 07:00:00 AM to the query I receive a DB error of: ORA-01830: date format picture ends before converting entire input string. Can someone please help me? Thank you, Justin I am joining two tables: cxadmin.ro_hist and cxadmin.ord_dtl and use the in function b/c I have to update multiple rows. My query so far is:

    UPDATE cxadmin.ro_hist
    SET DOCK_DATE = '20-APR-2011 7:00:00 AM'
    where repair_ord in (
    select recv_repair_ord from cxadmin.ord_dtl
    where ord_nbr = '602945RR' AND DOCK_DATE > '20-APR-2011' )

    B C 2 Replies Last reply
    0
    • J Justiin1265

      Hi, I have to query an update for date and time. I know how to update the date alone, but I am having trouble with adding the time to the function. Right now, as it stands, it reads 4/20/2011 1:32:07 PM. I need the dock_date field to read 4/21/2011 7:00:00 AM. When I add 07:00:00 AM to the query I receive a DB error of: ORA-01830: date format picture ends before converting entire input string. Can someone please help me? Thank you, Justin I am joining two tables: cxadmin.ro_hist and cxadmin.ord_dtl and use the in function b/c I have to update multiple rows. My query so far is:

      UPDATE cxadmin.ro_hist
      SET DOCK_DATE = '20-APR-2011 7:00:00 AM'
      where repair_ord in (
      select recv_repair_ord from cxadmin.ord_dtl
      where ord_nbr = '602945RR' AND DOCK_DATE > '20-APR-2011' )

      B Offline
      B Offline
      Blue_Boy
      wrote on last edited by
      #2

      Have you tried to convert on date type? e.g TO_DATE('20-APR-2011 7:00:00 AM', 'dd-MM-yyyy HH:MI:SS AM')


      I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post. www.cacttus.com

      J 1 Reply Last reply
      0
      • J Justiin1265

        Hi, I have to query an update for date and time. I know how to update the date alone, but I am having trouble with adding the time to the function. Right now, as it stands, it reads 4/20/2011 1:32:07 PM. I need the dock_date field to read 4/21/2011 7:00:00 AM. When I add 07:00:00 AM to the query I receive a DB error of: ORA-01830: date format picture ends before converting entire input string. Can someone please help me? Thank you, Justin I am joining two tables: cxadmin.ro_hist and cxadmin.ord_dtl and use the in function b/c I have to update multiple rows. My query so far is:

        UPDATE cxadmin.ro_hist
        SET DOCK_DATE = '20-APR-2011 7:00:00 AM'
        where repair_ord in (
        select recv_repair_ord from cxadmin.ord_dtl
        where ord_nbr = '602945RR' AND DOCK_DATE > '20-APR-2011' )

        C Offline
        C Offline
        Corporal Agarn
        wrote on last edited by
        #3

        For SQL Server you might try:

        SET DOC_DATE = CAST('20-APR-2011 7:00:00 AM' AS DATETIME)

        or possibly:

        SET DOC_DATE = '20-APR-2011 7:00:00' -- NO AM

        1 Reply Last reply
        0
        • B Blue_Boy

          Have you tried to convert on date type? e.g TO_DATE('20-APR-2011 7:00:00 AM', 'dd-MM-yyyy HH:MI:SS AM')


          I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post. www.cacttus.com

          J Offline
          J Offline
          Justiin1265
          wrote on last edited by
          #4

          Thank you. It worked!

          B 1 Reply Last reply
          0
          • J Justiin1265

            Thank you. It worked!

            B Offline
            B Offline
            Blue_Boy
            wrote on last edited by
            #5

            No problem :)


            I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post. www.cacttus.com

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups