• Hope this is useful for people hunting through old but well named topics.

    This works

    declare @var varchar(max) = ' '

    select len(@var)

    This doesn't

    declare @var varchar(max) = ' '

    select len(cast( @var as text))

    Msg 8116, Level 16, State 1, Line 7

    Argument data type text is invalid for argument 1 of len function.

    This doesn't

    declare @var varchar(max) = ' '

    select left(cast( @var as text) ,2)

    So it seems like the trend is that you cannot do any string manipulation with text fields.

    Also, this

    declare @var text = ' '

    Msg 2739, Level 16, State 1, Line 2

    The text, ntext, and image data types are invalid for local variables.

    Even more reason to get rid of TEXT, NTEXT etc.

    Catch-all queries done right [/url]
    Gail Shaw's Performance Blog[/url]