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
2
votes
1 answer

Load data from Table with column NVARCHAR(MAX) - Cannot convert to string as value is getting truncated

I have a DFT with OLEDB Source - sql table with column named description data type NVarchar(Max) select max(len(description)) from tbl_Test -- returns 10,000 script transformation editor to perform transformation Output0Buffer.AddRow(); …
sushu
  • 49
  • 2
2
votes
1 answer

Best size of comment - SQL Server

Best length of comment on app is 4000? I want to know standard of social network. How can I show it on SQL Server? Is it must be nvarchar(?) or varchar(?) or ntext or ...? Thanks for your help
Mohi
  • 25
  • 1
  • 1
  • 7
2
votes
3 answers

SQL-Server: Creating a view with substring on a column, substring returns null when there is data

I'm creating a view to get a substring of a column named ScopeContent in database X it has a datatype of ntext. When I'm looking at the value of ScopeContent in the view some of the data is null while others have data. For example, the first record…
Andy N
  • 21
  • 1
  • 3
2
votes
1 answer

Use nvarchar datatype in SQL Server CE with EF code-first

I use SQL Server CE with EF code-first. I have following domain class: public class User:BaseEntity { public User() { this.UserForms = new List(); IsAdmin = false; IsActive = true; } public string…
2
votes
2 answers

NTEXT with more than 4000 characters in SQL Server CE in Windows Phone

NTEXT with more than 4000 characters in SQL Server CE in windows phone I have a database in my windows phone app with a ntext field in one of the tables, I'm trying to write some content to this field, but I get an InvalidOperationException with the…
Eric.M
  • 827
  • 1
  • 14
  • 29
2
votes
1 answer

SQL Server generic trigger creation

I am trying to create a generic trigger in SQL Server which can copy all column data from Table A and insert them in corresponding fields in Table B. There are few problems I am facing. I need this copy to occur under three conditions : INSERT,…
Ben Kin
  • 21
  • 2
1
vote
2 answers

C# Databindings to varchar, text fields

I am using Databindings in my app in this way: textBox1.Databindings.Add(new Binding("Text", myObject, "myObjectField")); Everything is OK, when field in database is type of varchar. Then size of field is defined by me. Problem is when field in…
zmierzlik
  • 17
  • 3
1
vote
0 answers

Hibernate HQL - casting NTEXT to NVARCHAR for a GROUP BY

I'm having some problems running a group by on a SQL Server query using Hibernate HQL. The table in question has NTEXT columns. Note the two CONVERT fields... However, Hibernate chokes on this. Any suggestions on how best to pass this through to…
Squiggs.
  • 4,299
  • 6
  • 49
  • 89
1
vote
1 answer

Sql-server – Convert all ntext columns to nvarchar(max)

I'm trying to convert all ntext columns in my database to nvarchar(max). This is the code: DECLARE @command NVARCHAR(MAX); DECLARE @numberOfRecordsToUpdate as int; DECLARE @numberOfRowsUpdated as int; DECLARE…
satcha
  • 129
  • 1
  • 13
1
vote
3 answers

Entity Framework & SQL Compact Edition - how do I get ntext?

The answer to my question should be quite obvious, but I cannot find it. I have a edmx file that has one table. There is a field of type string. EF always generates nvarchar for that (which is kind of expected), but I need an ntext instead of…
Jefim
  • 3,017
  • 4
  • 32
  • 50
1
vote
2 answers

MS SQL Server cannot call methods on ntext

I am trying to create a view in MS SQL server from a table. The table name is Account_Plan and I am trying to create a view as Account_Plan_vw. While executing the DDL to create the view, I am getting the error as shown below. Msg 258, Level 15,…
Balaji Pooruli
  • 240
  • 1
  • 3
  • 16
1
vote
1 answer

Cannot Insert NULL into NTEXT field in SQL CE?

A simple example: CREATE TABLE People ( personID int not null , name nvarchar(50) not null , addrLine1 nvarchar(50) null , addrLine2 nvarchar(50) null , suburb nvarchar(30) not null ,…
joedotnot
  • 4,810
  • 8
  • 59
  • 91
1
vote
1 answer

SQL Server Trace file create unique identifier for field TextData of type NTEXT

To analyse my imported trace file it would like to have a unique value for Select Distinct TextData from myImportedTraceFile I tried using hashbyte although i am not sure if MD5 is the right tool to create a unique identifier. Even if this were…
surfmuggle
  • 5,527
  • 7
  • 48
  • 77
1
vote
1 answer

Entity Framework 5 ntext equals error

i have the following error when trying to find a record in database by ntext field using Entity Framework enter code hereThe data types ntext and nvarchar are incompatible in the equal to operator. I found a few articles here related to that…
Vladyslav Furdak
  • 1,765
  • 2
  • 22
  • 46
1
vote
2 answers

Replace newline in ntext

One of the columns uses ntext. I want to replace the newlines and carriage returns in to space but I can only do it one at a time. Is there a way I could use CHAR(10) and CHAR(13) at the same time using the script below on SQL Server…
FoxyReign
  • 57
  • 1
  • 8