erigaud
Honored Contributor

VARCHAR allows you to specify the size of the string expected in the column. 

This is useful when you know your column cannot exceed a set size (ie for a name, a code etc).

It is equivalent to a CHECK contraint on the size. Trying to insert a value that exceeds the size given results in the following error : 

com.databricks.sql.transaction.tahoe.schema.DeltaInvariantViolationException: Exceeds char/varchar type length limitation. Failed check: (isnull('last_name) OR (length('last_name) <= 50)).
 

View solution in original post