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 convert a varchar field into the datetime data type

How do i convert a varchar field into the datetime data type

Scheduled Pinned Locked Moved Database
helpquestiondatabasesql-serverdesign
2 Posts 2 Posters 0 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.
  • R Offline
    R Offline
    Rameez Raja
    wrote on last edited by
    #1

    hi, How do i convert a varchar field into the datetime data type? the reason i need this lies in the requirement that in the earlier data base the column that is holding the date value is having the data type as varchar. and in the new design the column data type is datetime. How i transfer old Data to new column without loss .from the older design to the newer and got stuck with this datetime convertion issue. do let me know the best possible solution.iam using sql server 2000 following are the sample date Format that is there in the older table for the date. dd/mm/yyyy. Regards Rameez

    A 1 Reply Last reply
    0
    • R Rameez Raja

      hi, How do i convert a varchar field into the datetime data type? the reason i need this lies in the requirement that in the earlier data base the column that is holding the date value is having the data type as varchar. and in the new design the column data type is datetime. How i transfer old Data to new column without loss .from the older design to the newer and got stuck with this datetime convertion issue. do let me know the best possible solution.iam using sql server 2000 following are the sample date Format that is there in the older table for the date. dd/mm/yyyy. Regards Rameez

      A Offline
      A Offline
      Alsvha
      wrote on last edited by
      #2

      Try:

      Convert(DATETIME, 'your datestring in dd/mm/yyyy format here', 103)

      --------------------------- Blogging about SQL, Technology and many other things

      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