automatic cast from a text field to a varchar?

  • SELECT OPOR.DocNum AS 'Style No.',INV10.LineText,

    max(case when ITM1.PriceList=1 then ITM1.Price end) as 'First Cost'

    FROM OPOR, INV10, ITM1

    GROUP BY OPOR.DocNum,INV10.LineText, ITM1.Price

    this is my code..

    i get the error: "The text, ntext, image data types cannot be compared or sorted, ecept when using IS NULL or LIKE Operator"

    how can i cast LineText to make this code work? (i do not know the lenght)

    Any help is appreciated..Thanks

  • use:

    cast ( field as varchar(max) )


    * Noel

  • thank you

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply