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)
 Text Feedback

Author  Topic 

SamC
White Water Yakist

3467 Posts

Posted - 2002-08-07 : 11:11:00
I've been asked to implement a table to hold feedback from our users. I'll be sure to use a foreign key of "email"...

Feedback input from users will be variable length text. It would be bad form to limit the amount of user feedback, but I've never designed a table with this in mind. I imagine even variable length string columns are allocated in full in a table - so an empty response from a user would still allocate a full column width according to the declaration? With this in mind, I suppose limiting the column width to 2000 characters ought to be reasonable for feedback archival..

The next issue would be how to handle the SQL error that will be generated if a user enters more text than the column can accomodate?

Given:
Column Form01 varchar 2000
Column Form02 varchar 2000

In ASP/ADO I could test for the column maximum width and limit the length of the corresponding column value.

But I'd rather not write the code to perfom this if SQL offers a way to automatically truncate the text. If one exists, I haven't been able to find it.

SamC

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2002-08-07 : 11:22:14
A fellow Marylander....kewl...

First, be careful attatching yourself too much to this natural key thing. In logical design, it's the way to go, but when it comes to physical implementation, there are many factors to consider.

You've got a couple storage options for you 'Feedback'

  • User a text datatype. This will hold up to 2 gigs of data (1 gig if Unicode). Sometimes BLOBs can be difficult to work with depending, so this is an option you will want to test before you go with it.

  • You can trim your feedback to whatever length you want using build in string functions. This can be done in a proc before insert it into your table.

  • You could store chuncks for you 'Feedback text' in multiple rows with a rownumber. Then you can glue the chuncks back together on the way back to the display layer.



Each of these options as benefits and tradeoffs. You should test each, read about each and have a full grasp of everything that is at stake before you make your final decision on which way to go.

Jay White
{0}
Go to Top of Page

MichaelP
Jedi Yak

2489 Posts

Posted - 2002-08-07 : 12:19:06
You guys are from MD eh?
I'm originally from Westminster, in Carroll County.

<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Go to Top of Page
   

- Advertisement -