Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2013
    Posts
    21

    Unanswered: Select from where promblem on Time type column

    Hi,


    I use SQL Server 2008.

    My JPQL request :
    Code:
    When I use a "select mytable from MyTable mytable where mytable.mytime = :timeParam"
    The JDBC driver (v4) send to me a error :
    19:32:22,753 WARN JDBCExceptionReporter:233 - SQL Error: 402, SQLState: S0001
    19:32:22,758 ERROR JDBCExceptionReporter:234 - The data types time and datetime are incompatible in the equal to operator.

    The Java type of my parameter is java.sql.Time but not Date !

    Thanks for your help.

    Nassa.

  2. #2
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,800
    Provided Answers: 11
    Use
    Code:
    convert (time, :timeParam)
    in you where clause. This should strip off the vestigial date portion of the parameter.

  3. #3
    Join Date
    Feb 2013
    Posts
    21
    I MCrowley,

    Finally, I used a parameter Date and not Time type with your line code convertion.
    It's work very well.

    Thanks very much for your help.

    Nassa.
    Last edited by nassarane; 10-18-13 at 13:05.

Posting Permissions

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