如何增加nvarchar(4000)的限制?在SQL Server 2014中? [英] How to increase limit of nvarchar(4000) ? in SQL server 2014 ?

查看:287
本文介绍了如何增加nvarchar(4000)的限制?在SQL Server 2014中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!



i需要将文本数据存储到sql server 2014的数据库字段中。

我的文本数据想存储包含超过4000个字符(即10,000到.......)因为数据是用户输入的段落正文文本的形式。



但问题是sql server 2014的nvarchar数据类型有4000个限制。



我该怎么做?



任何人都可以有任何想法!



谢谢!



我尝试了什么:



我通过传递长度超过4000的文本尝试了我自己,但它给出了错误二进制数据会被截断

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"

推荐答案

使用 navarchar(max),其限制为2 31 -1字节(2 GB)。

nchar和nvarchar(Transact-SQL ) [ ^ ]



避免旧的 ntext 类型,已被弃用多年,将从SQL Server的未来版本中删除。

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 image 数据类型将将在Microsoft SQL Server的未来版本中删除。避免在新的开发工作中使用这些数据类型,并计划修改当前使用它们的应用程序。使用 nvarchar(max) varchar(max) varbinary(max)而不是。


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.


您应该使用 ntext 类型而不是 nvarchar

您还可以使用 varbinary(max)数据类型。
You should use the ntext type instead of nvarchar.
You could also use the varbinary(max) datatype.


这篇关于如何增加nvarchar(4000)的限制?在SQL Server 2014中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆