Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get the length of string for Text or Ntext type field

Status
Not open for further replies.

umeshs79

Programmer
Aug 7, 2002
42
DE
Hi,
I need the length of the string of a TEXT or NTEXT type field in my table. but as LEN() function does not work on TEXT or NTEXT type field. So please can anybody tell me how I get the length of the string in NTEXT or TEXT type field.

Thanks Umesh Sharma,MCSD
India
 
Use the DATALENGTH function. It will return the number of BYTES not the number of chanracters. If the column is TEXT, the number of bytes and characters will be the same. If NTEXT, the number of bytes will be twice the number of characters. If you want to get the best answer for your question read faq183-874 and thread183-468158.
Terry L. Broadbent - DBA
SQL Server Page:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top