Click here to Skip to main content
15,900,973 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi!

i need to store a text data into a field of database of sql server 2014.
the text data that i want to store contains more than 4000 characters (i.e. 10,000 to .......) because the data is in the form of paragraph righting text entered by the user.

but problem is that there is limit of 4000 in nvarchar datatype of sql server 2014.

how can i do this ?

can anyone have any idea !

Thanks!

What I have tried:

I tried it my self by passing the text of having 4000+ length but it gives error of "binary data would be truncated"
Posted
Updated 8-Apr-16 3:56am

Use navarchar(max), which has a limit of 231-1 bytes (2 GB).
nchar and nvarchar (Transact-SQL)[^]

Avoid the old ntext type, which has been deprecated for many years, and will be removed from a future version of SQL Server.

ntext, text, and image data types will be removed in a future version of Microsoft SQL Server. Avoid using these data types in new development work, and plan to modify applications that currently use them. Use nvarchar(max), varchar(max), and varbinary(max) instead.
 
Share this answer
 
You should use the ntext type instead of nvarchar.
You could also use the varbinary(max) datatype.
 
Share this answer
 
Comments
Richard Deeming 8-Apr-16 9:53am    
ntext has been deprecated for many years.

Use nvarchar(max) instead.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900