Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2008

    Unanswered: Converting Varchar string (DDMMYYYY HR:MIN:SEC) to date/time

    Hi All good Morning,

    I have varchar string in formate DDMMYYYY HR:MINEC (25092008 08:39:24
    ). I need to store this in one date/time field in sql server.

    Can anyone suggest whether it is possile or not?


  2. #2
    Join Date
    Feb 2004
    In front of the computer
    Provided Answers: 54
    You've posted this question in DBForum's MySQL forum, but seem to be asking about Microsoft SQL Server which makes me think the question belongs in the Microsoft SQL Server forum.

    To answer your question, yes... A date in 2008 with time to the second can be stored in a DATETIME column. The internal formatting is binary in either case, and the presentation formatting can be handled in either the client (which is strongly preferred for many reasons) or at the server.


  3. #3
    Join Date
    Nov 2008
    Sorry Pat i posted query in worng forum.

    Can you please explain me exactly how to do like format of covert function if any.

  4. #4
    Join Date
    May 2005
    South Africa
    Provided Answers: 1
    The convert function does not allow for this format
    You'll have to stuff some chars into the date portion and use e.g. code 105
    select convert(datetime,stuff(stuff('25122008 23:59:30',5,0,'-'),3,0,'-'),105)

Posting Permissions

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