I want to ask:
len(someTextField)
ltrim(someTextField)
which doesn’t work, as the above functions apparently only work with string but not text
Any alternative ways to perform the same?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Use
varchar(max)nottextsince SQL Server 2005+If you are stuck with text or ntext, you can use DATALENGTH to replace LEN. There are differences with it (no implied RTRIM, measures bytes not characters) but your options are limited.
There is no LTRIM equivalent for the old datatypes
You can CAST the columns though: