4

I ran into a truncation error while inserting user data into a database using the documented field length (buffer size) of 3000.

So I redefined to nvarchar(max), pulled all users in the stack exchange universe with rep > 100 and checked the field lengths.

Here are the results for Users.

UserType             
-------------------- 
10                   

DisplayName          
-------------------- 
40                   

AboutMe              
-------------------- 
3229                 

Location             
-------------------- 
92                   

WebsiteUrl           
-------------------- 
200                  

EmailHash            
-------------------- 
32                   

I am guessing that the recommended field size for text fields is approximated as it is stored in markdown format but we get it in expanded html which is an arbitrary length.

So, i would recommend adding an extra K for user.about_me, question.body, answer.body and even comment.body.

2
  • 1
    Good catch. I haven't done any caching of user accounts yet but was planning on doing it this week. Commented Aug 9, 2010 at 0:18
  • @far - check this out - stackapps.com/questions/386/… Commented Aug 9, 2010 at 4:37

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.