Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 What is the best sql-type to store HTML

Author  Topic 

mathmax
Yak Posting Veteran

95 Posts

Posted - 2007-07-10 : 18:47:34
Hello,
in you mind, what is the best sql-type to store HTML text ?

thanks.

cvraghu
Posting Yak Master

187 Posts

Posted - 2007-07-10 : 19:06:28
We are using nvarchar(max). Not sure whether thats the BEST.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2007-07-10 : 19:14:40
It depends. Will your HTML contain unicode data? If so, you'll have to go with nvarchar data type. Will your HTML ever exceed 8000? If so, then max for the size would be needed.

I don't think that there's only one answer for this. nvarchar(max) would be able to cover all bases, but do you really need to store unicode or that much data?

Tara Kizer
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

mathmax
Yak Posting Veteran

95 Posts

Posted - 2007-07-10 : 19:15:01
I cannot store multi-line text with nvarchar(max). Do you know why ?
Go to Top of Page

cvraghu
Posting Yak Master

187 Posts

Posted - 2007-07-10 : 19:19:27
That should not be a problem. Please be more specific and provide more information.
Go to Top of Page

mathmax
Yak Posting Veteran

95 Posts

Posted - 2007-07-10 : 19:34:56
I would like to put a multi-line text in the field, but it doesn't work. In fact it is the same with all sql data type. I copy/paste the multi-line text in the field, but just one line (the first) is really copied. Do you know why ?
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2007-07-10 : 19:36:18
What is meant by copy/paste the multi-line text in the field? Do you mean in some query editor? Have you tried running an INSERT statement or doing this from your application?

Tara Kizer
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

mathmax
Yak Posting Veteran

95 Posts

Posted - 2007-07-10 : 19:51:57
Yes I access the table with Visual Studio 2005 and then I copy the html from a file to a field in the database. I've also tried an update statement, but I don't know how to write carriage return in the statement.
Go to Top of Page

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2007-07-11 : 11:43:53
Look up the CHAR fucntion in Books Online (BOL):

Tab
char(9)

Line feed
char(10)

Carriage return
char(13)

Go to Top of Page
   

- Advertisement -