java - How to store and retrieve text data in a formatted way? -


i building website using java , sql server database. stack overflow have store questions, answers, comments , images.

i not able store text in formatted way in sql server's text data type. neither able display in formatted way stack overflow does. solutions i've found far concerns php , mysql. no java , sql server. when retrieve text display on web page it's mess. want display question , answers on website stack overflow does. i'm attaching image of display page here explain problem. it image of text ousput display website.

image of output display website

first off: msdn, "text", "ntext" , "image" data types removed sql server, should avoid using them.

for text, use varchar(max); ntext, use nvarchar(max) , image, use varbinary (max).

i know developing ssis packages sql server processes text types stream of non-unicode characters. advise try is:

  1. change datatype nvarchar(max), support unicode characters, might problem;

  2. try convert nvarchar(max) string type before displaying. can cast data using sql server, in stored procedure.


Comments