Published on: 15 Jan, 2014

How to get the length of ntext in SQL Server?

Tumblr Digg Google Plus

You may wonder when you use the function LEN() to get the length of the ntext or image field, you will get an error. This is because the LEN() function is only used to get the length of the nvarchar, varchar or char field types only.

To get the length of the ntext or image field type, you can use the DATALENGTH() function, see below example:

SELECT DATALENGTH(FIELD_NAME) FROM TABLE_NAME

Comments

There are no comments available.

Write Comment
0 characters entered. Maximum characters allowed are 1000 characters.