Uploaded image for project: 'Teiid'
  1. Teiid
  2. TEIID-3376

SQL Server 2008/2012 - incompatible data types in comparison after cast/convert

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 8.11
    • 8.7.1
    • None
    • None
    • Hide

      SQL Server 2008/2012 table:
      StringNum varchar
      CharValue char
      DoubleNum decimal
      BigIntegerValue decimal
      ShortValue decimal
      FloatNum float
      ObjectValue text
      IntNum decimal
      BigDecimalValue decimal
      LongNum decimal
      BooleanValue bit
      TimestampValue datetime
      ByteNum decimal
      IntKey decimal
      StringKey varchar
      TimeValue time
      DateValue date

      Teiid table:
      INTNUM integer
      BIGDECIMALVALUE bigdecimal
      BIGINTEGERVALUE biginteger
      BOOLEANVALUE boolean
      BYTENUM byte
      CHARVALUE char
      DATEVALUE date
      DOUBLENUM double
      FLOATNUM float
      INTKEY integer
      LONGNUM long
      OBJECTVALUE object
      SHORTVALUE short
      STRINGKEY string
      STRINGNUM string
      TIMESTAMPVALUE timestamp
      TIMEVALUE time

      Queries:
      SELECT convert(TimestampValue, time) FROM <table> WHERE convert(TimestampValue, time) > '00:00:00'

      SELECT cast(TimestampValue as time) FROM <table> WHERE cast(TimestampValue as time) > '00:00:00'

      Show
      SQL Server 2008/2012 table: StringNum varchar CharValue char DoubleNum decimal BigIntegerValue decimal ShortValue decimal FloatNum float ObjectValue text IntNum decimal BigDecimalValue decimal LongNum decimal BooleanValue bit TimestampValue datetime ByteNum decimal IntKey decimal StringKey varchar TimeValue time DateValue date Teiid table: INTNUM integer BIGDECIMALVALUE bigdecimal BIGINTEGERVALUE biginteger BOOLEANVALUE boolean BYTENUM byte CHARVALUE char DATEVALUE date DOUBLENUM double FLOATNUM float INTKEY integer LONGNUM long OBJECTVALUE object SHORTVALUE short STRINGKEY string STRINGNUM string TIMESTAMPVALUE timestamp TIMEVALUE time Queries: SELECT convert(TimestampValue, time) FROM <table> WHERE convert(TimestampValue, time) > '00:00:00' SELECT cast(TimestampValue as time) FROM <table> WHERE cast(TimestampValue as time) > '00:00:00'

    Description

      If user want to cast/convert timestamp-value to time and then use it in comparison, Teiid throws an Exception:
      "SQLServerException: The data types datetime and time are incompatible in the greater than operator."

      Expected behavior:
      The query should return correct result as the SQL Server is able to handle similar queries (teiid does not have any problem with same query with oracle, postgres, mysql,...)

      Attachments

        Activity

          People

            rhn-engineering-shawkins Steven Hawkins
            jdurani Juraj DurĂ¡ni (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: