SQL SERVER – Find Length of Text Field

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

Reference : Pinal Dave (https://darkslategrey-bat-805937.hostingersite.com)

SQL Function, SQL Scripts
Previous Post
SQLAuthority.com News – Journey to SQL Authority Milestone of SQL Server
Next Post
SQL SERVER – Retrieve Current DateTime in SQL Server CURRENT_TIMESTAMP, GETDATE(), {fn NOW()}

Related Posts

Leave a Reply