Help on the following SQL server Select query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • inlovewithmusic
    New Member
    • Nov 2006
    • 14

    #1

    Help on the following SQL server Select query

    SELECT *
    FROM jake19812ce655. .FIREFOX_Memory
    WHERE Date >= 2008-08-27 04:33:00
    AND Date <= 2008-08-27 04:34:23


    hi ..when running the above given query I am getting an error message that says
    Msg 102, Level 15, State 1, Line 4
    Incorrect syntax near ':'.

    I dont understand what's wrong as the date column in FIREFOX has valid
    rows with date/time values in them
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    Originally posted by inlovewithmusic
    SELECT *
    FROM jake19812ce655. .FIREFOX_Memory
    WHERE Date >= 2008-08-27 04:33:00
    AND Date <= 2008-08-27 04:34:23


    hi ..when running the above given query I am getting an error message that says
    Msg 102, Level 15, State 1, Line 4
    Incorrect syntax near ':'.

    I dont understand what's wrong as the date column in FIREFOX has valid
    rows with date/time values in them
    Code:
    WHERE Date >= cast('2008-08-27 04:33:00' as datetime)
    That is if your Date column is of datetime data type

    --- CK

    Comment

    • shenliang1985
      New Member
      • Nov 2007
      • 3

      #3
      Code:
      select startdate from fortest;
      --startdate is a datetime type
      --the following are startdate's records in  table fortest
      startdate
      2008-08-08 12:12:12.000
      2008-08-21 21:21:21.000
      2006-07-07 00:00:00.000
      2009-09-09 00:00:00.000
      2008-08-08 12:12:12.000
      
      select startdate from fortest where startdate <'2009-09-09 10:00:00.000' and startdate>'2006-07-07 00:00:00.000'
      --now result
      startdate
      2008-08-08 12:12:12.000
      2008-08-21 21:21:21.000
      2009-09-09 00:00:00.000
      2008-08-08 12:12:12.000

      Comment

      Working...