I have a SQL Server CE database in which I have column that takes values of json strings. These json strings are above 9kb as a result of which I am unable to use varchar or char. I guess I could tackle this through the usage of ntext.

But in SQL Server, this is marked to be removed in an upcoming edition. I am not sure of SQL Server CE. Also I am having where and having conditions / statements on other values stored in this column.

Therefore having ntext may not help as well. Are there any other data types that I could use to store this json string? Any help would be much appreciated.


Just because something is marked as deprecated doesn't meant that it's disappearing soon - there are features that have been marked deprecated for several versions which haven't been removed yet. That said, you're right to move away from deprecated features if the opportunity presents itself (but don't make changes simply for the sake of change), and you should definitely avoid implementing anything new using a deprecated feature.

Per Microsoft's documentation on ntext, the replacement for ntext is nvarchar(max).

You may also be interested in reading about SQL Server 2016's support for JSON data.

| improve this answer | |
  • nvarchar(max) is not working with SqlCE. As explained in the question, I cannot use ntext as there are other queries on this column that use "where" and "having" clauses. :( – AnOldSoul Mar 20 '17 at 10:59
  • @mayooran It may be too old for nvarchar(max) then. But you should also be aware that, since you're trying to get rid of deprecated things, SQL Server CE itself is deprecated - so take this opportunity to move to something that is both supported and meets your requirements. – alroc Mar 20 '17 at 11:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.