Thread: Date Testing

    #1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Location
    uk
    Posts
    91
    Rep Power
    12

    Date Testing


    Hi All,

    in SQLServer 2000 as part of a Select statement I have:

    (CONVERT(char(11), dbo.Submission.GatewayTimestamp, 103) > '13/05/2001')

    in my Where clause.

    The GatewayTimestamp column is of type datetime.

    Why do I have returned records where the date is '24/04/2001' as well as Records > than my date specified?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2003
    Location
    Paris Uppland
    Posts
    2,383
    Rep Power
    391
    That's because you are comparing strings and not dates. '2' is larger than '1'

    Code:
    where dbo.Submission.GatewayTimestamp > '2001-05-13'
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Location
    uk
    Posts
    91
    Rep Power
    12
    Just specifying the column, gives me an out of range error
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2003
    Location
    Paris Uppland
    Posts
    2,383
    Rep Power
    391
    Could you post the query you used and the exact error message.

IMN logo majestic logo threadwatch logo seochat tools logo