SQL Server 2000 Enterprise Manager - Store nvarchar data greater than 4000 characters?

孤者浪人 提交于 2019-12-13 05:07:08

问题


I'm using SQL Server 2000 Enterprise Manager. I'm having trouble with storing some data in a column. The column has a data type of nvarchar, with a length of 4000, which I've now learned is the max length you can have.

I need to store data in the column that is longer than 4000 characters...is there a way to increase the size? Or is there another way to store it?


回答1:


in SQL Server 2000, the only 2 ways to increase it would be:

  • Use the data type VARCHAR instead of NVARCHAR (VARCHAR's limit is 8000, where NVARCHAR's is 4000) NVARCHAR is the unicode version of VARCHAR.

  • Use the TEXT or NTEXT datatypes. TEXT stores the value outside of your table, and can store up to 2^31 - 1 characters. NTEXT can store up to 2^30 - 1 characters.




回答2:


First, follow @Gabriel's advice if you can live with 8000 non-Unicode characters.

In places where older versions of our app needed to store larger text strings, we allocated multiple fields (textvar, textvar2, ...) and had standard application components to split & concatenate them where they were used. Otherwise, you can use a blob & convert as needed. Ugly but functional.



来源:https://stackoverflow.com/questions/3916451/sql-server-2000-enterprise-manager-store-nvarchar-data-greater-than-4000-chara

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!