Skip to main content
Source Link
Sky Sanders
  • 12.1k
  • 3
  • 32
  • 60

recommended buffer size for markdown fields is conservative

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.

Post Made Community Wiki by CommunityBot