Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2007

    Question Unanswered: Stupid Date question

    I've got a table where there is a date as a datetime in the form 'mm/dd/yyyy', and some times as text in the form hh:mm AM/PM (no leading zero's except on minutes, so September 3rd, 2007 would be '9/3/2007' and 6AM would be '6:00 AM'). How would I merge the two to make a single datetime that would include both the date and the time? Example:

    Create Table Events ( MyDate datetime, MyTimestamp text )
    INSERT INTO Events VALUES ( '9/3/2007', '6:00 AM' )
    I want a simple query that returns: '9/3/2007 6:00 AM' as a single datetime. How do I do that? And before you mention it, I didn't design this table, and I can't change it. I know it's not a very good way to do this, but there you have it.

  2. #2
    Join Date
    Dec 2002
    Préverenges, Switzerland
    if you are in Access/JET and you don't mind cheating, try with this:
    SELECT MyDate + CDate(MyTimestamp) AS MyDateTime FROM Events

    it IS cheating!

    currently using SS 2008R2

  3. #3
    Join Date
    Dec 2004
    Madison, WI
    You also might want to try using the # instead of the '
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  4. #4
    Join Date
    Dec 2007

    Red face re hello

    Hi, I have a problem with a DB access created with access 2000 and used in 2003. a ctime.dll is missing appear when i launched a request it happen only with few DB not all

    Thanks for answering.


Posting Permissions

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