Questions tagged [ntext]

ntext is a data type in SQL Server. Questions should be specifically about the ntext data type, such as it's behaviour or (lack of) functionality, such as when compared to nvarchar(MAX) that superceded it in SQL Server 2005.

ntext allows for storage of values longer than 4,000 characters/8,000 bytes in a string based data type in SQL Server.

The data type was deprecated in SQL Server 2005 and should not be used in new development work, and ideally work to replace any existing use of it should be completed. Microsoft have stated the data type will be removed in a future version of SQL Server, however, as of SQL Server 2022 the data type has not yet been removed.

ntext (as well as text and image) cannot be used in a lot of functionality that the newer data types can be used in.

56 questions
74
votes
2 answers

What's the right way to compare an NTEXT column with a constant value?

If I use something like [ntext2] <> '1,032.5', I get this error: The data types ntext and varchar are incompatible in the not equal to operator. The best possible solution would be if comparison is implemented in the same way for any column type.…
noober
  • 4,819
  • 12
  • 49
  • 85
12
votes
3 answers

ASP.Net Text with LineBreak from Multi-Line-TextBox to save in a database

I have PrivateMessage-System in my new Community-Page. I have a Multiline-Textbox for the Text of a private message. I save this text in a string, this string in a ntext SQL-Coloumn. I read this text from the ntext SQL-Coloum in a string and show it…
PassionateDeveloper
  • 14,558
  • 34
  • 107
  • 176
9
votes
5 answers

The data types ntext and nvarchar are incompatible in the equal to operator

I have a problem and i dont know how to fix it. I have a simple table in database CREATE TABLE [dbo].[home] ( [Id] INT NOT NULL, [text] NTEXT NOT NULL, PRIMARY KEY CLUSTERED ([Id] ASC) ); I`m using FormView in visual studio 2012,…
user3224399
  • 91
  • 1
  • 1
  • 3
9
votes
1 answer

LINQ problems with NText, Text and Image on SQL server

Apologies up front, because this isn't a question but a solution - but it took a lot of searching to find out the answer and google wasn't much help, so I wanted to give something back to the community by providing the error and the solution to help…
Alex White
  • 1,486
  • 16
  • 22
9
votes
3 answers

Concatenate ntext in SQL Server 2005

I need to concatenate 2 ntext columns into one. I can't convert them to nchar, cause both contains strings longer than 4000 chars. Is there a way to do this in SQL Server 2005?
MariusCC
  • 617
  • 2
  • 6
  • 11
8
votes
1 answer

GROUP BY for ntext data

I would like to see how many times the field MSGTEXT is repeated in the table MMOUTBOUND. For that I use the following query: SELECT MSGTEXT, COUNT(*) TotalCount FROM MMOUTBOUND GROUP BY MSGTEXT HAVING COUNT(*)>1; But I get an error…
vicesbur
  • 335
  • 2
  • 5
  • 13
7
votes
1 answer

.NET MVC: How to define ntext field in Code-First for SQL CE?

I have the following model: public class Blog { public int BlogID { get; set; } public int CategoryID { get; set; } [MaxLength(70)] [Required] public string BlogTitle { get; set; } [Column(TypeName="ntext")] public…
Nestor
  • 1,969
  • 4
  • 25
  • 30
5
votes
4 answers

SQL Server NText field limited to 43,679 characters?

I working with SQL Server data base in order to store very long Unicode string. The field is from type 'ntext', which theoretically should be limit to 2^30 Unicode characters. From MSDN documentation: ntext Variable-length Unicode data with a…
No1Lives4Ever
  • 6,430
  • 19
  • 77
  • 140
5
votes
1 answer

T-SQL: Converting NTEXT to VARCHAR to INT/BIGINT

I have a table with a field of type NTEXT which stores many type of values, filesize among them. I'm trying to run a query on a list of records and add up the file sizes but I'm encountering this perplexing problem. Since NTEXT cannot be…
sergeidave
  • 662
  • 4
  • 11
  • 23
5
votes
3 answers

How to map ntext using NHibernate Mapping-By-Code feature of NHibernate 3.2?

I need to map ntext column of a table using the mapping by code feature in NHibernate 3.2, so that it doesn't get truncated to 4000 characters. What do I neet to change in the following example? "Notes" is the property which has ntext type in sql…
5
votes
1 answer

DBI: bind_param casts string to ntext -> nvarchar(max) and ntext are incompatible

I have a problem concerning perl DBI's bind_param. The following SQL works: my $sth = $dbh->prepare("SELECT id FROM table WHERE id = 'string'"); $sth->execute(); While the following doesn't: my $sth = $dbh->prepare("SELECT id FROM table WHERE id =…
sk904861
  • 1,247
  • 1
  • 14
  • 31
4
votes
1 answer

"Argument data type ntext is invalid for argument 1 of len function" error

I'm using entity framework and I write this code to get some result from DB: ReviewsDBEntities DB = new ReviewsDBEntities(); var result=DB.Review.Where(r => r.ReviewText.Length > 200); But I get this error as an inner error: "Argument data type…
Saman
  • 439
  • 7
  • 16
4
votes
2 answers

replace ntext (more than 4000 characters) in sql server 2000

How to replace text in sql server 2000 in a ntext column with more than 4000 characters? conversion to nvarchar(max) does not work as it truncates values.
Gabriel Diaconescu
  • 1,769
  • 3
  • 21
  • 31
4
votes
7 answers

NHibernate nvarchar/ntext truncation problem

I'm using nhibernate to store some user settings for an app in a SQL Server Compact Edition table. This is an excerpt the mapping file: Name is a regular…
Reiste
  • 316
  • 5
  • 13
3
votes
3 answers

How to get complete data from SQL management studio for ntext column?

I am using SQL server 2005. In one of the tables, I have a column "xmldefinition" which is of ntext type. Now the data in this column is very huge and contains whole xml text. eg:- .... I want to get the whole…
Sachin Shanbhag
  • 54,530
  • 11
  • 89
  • 103
1
2 3 4