• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 362
  • Last Modified:

how can I find out how many characters are in an ntext field?

Hello,  I have a field in a table which is of type ntext.  

I need to check how many characters are in this field to make sure that the import has pulled in all the data I expected it to.

When I try to create a query looking for the length of the field I get an error message.  Could someone please give me the correct syntax.

In MS Access I would have said:

SELECT  Len([qText]) AS Expr1
FROM STuestions

Could you give me the equivalent for sql server 2012.
1 Solution
David KrollCommented:
Use DataLength().
Aneesh RetnakaranDatabase AdministratorCommented:
if you are using sql server 2012, change the datatype to nvarchar(max) ; ntext and text are deprecated from 2008 onwards. on varchar(max) you can use LEN()
NemetonaAuthor Commented:
thank you, that worked.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now