Solved

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

Posted on 2013-06-24
3
353 Views
Last Modified: 2013-06-24
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.
0
Comment
Question by:Nemetona
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 11

Accepted Solution

by:
David Kroll earned 500 total points
ID: 39271960
Use DataLength().
0
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 39271982
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()
0
 

Author Closing Comment

by:Nemetona
ID: 39272049
thank you, that worked.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question