Thursday, December 2, 2010

SQL SERVER – Find Length of Text Field

How to find the length of the text field in sql server 2005?

Ans:

To measure the length of VARCHAR fields the function LEN(varcharfield) is useful.

To measure the length of TEXT fields the function is DATALENGTH(textfield). Len will not work for text field.

Example:

SELECT DATALENGTH(yourtextfield) AS TEXTFieldSize

I have found this answer from blog.sqlauthority.com

Thanks
blog.sqlauthority.com

No comments:

Post a Comment