Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2004
    Posts
    5

    Unanswered: Strip time out of a date field - sql

    Hi all,

    I have a table that I've imported into SQL - there is a field in there for date that must have used now(); as its default value (access).

    So the values are something like:

    01/11/2004 12:16:42

    I need a way to change the data so that the time element removed is the field just holds the date. Failing that a way to insert this from the existing field into a new field stripping the date off en route would be a great help.

    Many thanks

    Phil

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    CONVERT(CHAR(10), YourValue, 120)
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  3. #3
    Join Date
    Dec 2004
    Posts
    5

    Great - Works fine.

    Many thanks - greatly appreciated. That worked fine. I used:

    update bookings set webbookings = convert(varchar,booking_date,102)

    Ta

    Phil

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •