Why is 30 the default length for VARCHAR when using CAST?

后端 未结 6 586
误落风尘
误落风尘 2020-12-03 16:38

In SQL server 2005 this query

select len(cast(\'the quick brown fox jumped over the lazy dog\' as varchar))

returns 30 as length while the

6条回答
  •  醉酒成梦
    2020-12-03 17:03

    My theory is that default 30 character length originated from the U.S. Postal Service specs for name and address lines:

    http://pe.usps.gov/cpim/ftp/pubs/pub28/pub28.pdf

提交回复
热议问题