|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
finding length of text fieldI need to find the length of a text field.The len function doesn't work with
text fields. Is there an alternative? Thanks! DATALENGTH()
HP wrote: Show quote > I need to find the length of a text field.The len function doesn't work with > text fields. > Is there an alternative? > Thanks! HP (H*@discussions.microsoft.com) writes:
> I need to find the length of a text field.The len function doesn't work As Jens and Trey said there is datalength().> with text fields. In case you are using ntext, beware that datalength() returns the length in bytes, and includes trailing blanks. For instance: SELECT len(N'August '), datalength(N'August ') Returns (6, 18). -- Erland Sommarskog, SQL Server MVP, esq***@sommarskog.se Books Online for SQL Server 2005 at http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx Books Online for SQL Server 2000 at http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx |
|||||||||||||||||||||||