DF034: A variable-size datatype of very small length is used.
Last modified: December 25, 2024
The topic describes the DF034 T-SQL code analysis rule.
Category
BEST PRACTICE
Message
A variable-size datatype of very small length is used.
Description
It is not recommended to use variable-length data types with sizes less than 3 symbols.
Additional information
Using such small sizes may lead to inefficiencies in storage and processing, as variable-length data types are optimized for larger data sizes. Additionally, using very small sizes may not provide enough flexibility for storing meaningful data and could potentially lead to truncation or data loss if the data exceeds the specified size.
Noncompliant code example
DECLARE @v VARCHAR(1)
Compliant solution
DECLARE @v VARCHAR(30)
Was this page helpful?