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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Where to store my "text"?

Author  Topic 

Hommer
Aged Yak Warrior

808 Posts

Posted - 2006-06-21 : 17:30:23
Hi, everybody!

I have a question that I will like to hear from you all.

My question is almost opposite from the "breaking lines" post.

I want to find a best table structure to store text data. The UI looks pretty much like this message box that I am typing in. It only needs to be large enough to hold up to 5 paragraphes, each with up to 5 lines.

It needs to be editable/appendable later, and here is the challenging part, they want to insert a time stamp for each edit/append.

Do I use a text type and store every thing in it, or do I break them up in normalized way?

I did not see an easy way to parse the content in and out. The UI is a VB.Net Win Form.

Thanks!

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2006-06-21 : 17:34:25
It depends on the size of the data. If they can fit the data into varchar(8000), then I'd suggest using that instead of text. If the data can be larger than 8000 bytes, then yes use text. Both data types support formatting such as line breaks and carriage returns.

I wouldn't normalize it. I would store it as is in one column. But I guess you could use multiple varchar columns to avoid the text data type.

Tara Kizer
aka tduggan
Go to Top of Page

Hommer
Aged Yak Warrior

808 Posts

Posted - 2006-06-21 : 20:11:04
I have some sample data in a text type column. How can I query it and figure out the largest one is over 8000 byte or not?

How does this forum store these posts?

Again, my headache is on how to store the time stamp with each revisions. I hate to convert them into string and concatinate them with the text. Just wonder how others handle case like this.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2006-06-21 : 20:16:29
SELECT MAX(DATALENGTH(YourTextColumn))
FROM YourTable

I'm not sure how this forum stores things, but I would venture to say it's text due to the size of some posts I've seen. The stack dumps and DBCC CHECKDB output probably go over 8000 bytes.

For the timestamp issue, you can handle that in the query where you are updating (inserts would be handled via a default value) or via a trigger.

Tara Kizer
aka tduggan
Go to Top of Page

Hommer
Aged Yak Warrior

808 Posts

Posted - 2006-06-21 : 20:28:13
Great, Thanks!
Go to Top of Page
   

- Advertisement -