In SQL I have a table with around 2000 rows and i store XML's in a column. The data type of the column is text. Around 80 rows are currently trimmed off to exact 8000 characters. There are values in that column which has more than 8000 characters.what could be the issue.
Asked
Active
Viewed 165 times
0
-
1I'm not quite sure I understand what you're asking. Is your XML column stored as `text` data type? Why not use the `xml` data type in SQL Server? – dub stylee Feb 24 '15 at 00:22
-
@dubstylee here's another article on the differences between `xml` and `(n)varchar` http://stackoverflow.com/questions/514827/microsoft-sql-server-2005-2008-xml-vs-text-varchar-data-type – Kritner Feb 24 '15 at 00:33
-
@Kritner ah, good to know! I try to avoid `xml` storage in the database anyway just as a personal preference. Good to know that it also affects database performance :) – dub stylee Feb 24 '15 at 00:42
-
1`ntext`, `text`, and `image` data types will be removed in a future version of 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. [See details here](http://msdn.microsoft.com/en-us/library/ms187993.aspx) – marc_s Feb 24 '15 at 06:01
1 Answers
2
8000 characters is actually the maximum amount of characters that SSMS will display (by default), it will return to your front end the full amount - at least in the case of varchar(max)
. I think that is the case with text
as well, but I don't use text
type anymore :P
It should be noted, that you shouldn't be using the text
data type for sql server, as it is in the process of deprecation.
See: https://msdn.microsoft.com/en-us/library/ms143729.aspx for information on text
s deprecation.

Kritner
- 13,557
- 10
- 46
- 72