BP008
Published 16 November 2017
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.
This documentation contains proprietary information and is protected by copyright law.
Copyright © 2026 Red Gate Software Limited. All rights reserved