CAST/CONVERT to variable-size types without length

The length of VARCHAR, VARBINARY and NVARCHAR datatype in a CAST or CONVERT clause wasn’t explicitly specified.

When you convert a datatype to a variable-size type, you do not have to specify the size. If you don’t do so, SQL Server will use a variable-size type sufficient to hold the string. It is better to specify the size because SQL Server has no idea what size you may subsequently need.

Didn't find what you were looking for?