Doctrine 1
  1. Doctrine 1
  2. DC-828

MSSQL - ORDER BY on text columns throws mssql error 306 [+patch]

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.2.2
    • Fix Version/s: None
    • Component/s: Query
    • Labels:
      None

      Description

      • Table: foo (id:integer, title:text)
      • Created Query: SELECT [id], [title] FROM [foo] ORDER BY [title]

      Throws:

      Server: Msg 306, Level 16, State 2, Line 1
      The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator.
      

      Solution:

      • Created Query: SELECT [id], [title] FROM [foo] ORDER BY CAST([title] AS VARCHAR(8000))

      References:

      Patch will be supplied soon ...

        Activity

        Hide
        Enrico Stahn added a comment -
        Show
        Enrico Stahn added a comment - http://github.com/estahn/doctrine1/compare/DC-828 http://github.com/estahn/doctrine1/tree/DC-828 I guess we need more TestCases for the SubQuery stuff.
        Hide
        Enrico Stahn added a comment -

        I made a mistake with github, the updated branch can be found at
        http://github.com/estahn/doctrine1/tree/DC-828-2

        Show
        Enrico Stahn added a comment - I made a mistake with github, the updated branch can be found at http://github.com/estahn/doctrine1/tree/DC-828-2

          People

          • Assignee:
            Guilherme Blanco
            Reporter:
            Enrico Stahn
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: