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
Solved

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

Posted on 2013-06-24
3
350 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
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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

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…
I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

861 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