Click or drag to resize

SA0016 : Use of very small variable length type (size 1 or 2)

The topic describes the SA0016 analysis rule.

Message

Use of very small variable length type (size 1 or 2)

Description

This rule checks for use of very small variable length type (with size of 1 or 2).

It is recommended to use fixed length data type when size is less than 3. Variable length type with size less than 3 consumes more space than the same fixed length type.

Scope

The rule has a Batch scope and is applied only on the SQL script.

Parameters

Rule has no parameters.

Remarks

The rule does not need Analysis Context or SQL Connection.

Categories

Performance Rules

Additional Information

There is no additional info for this rule.

Example Test Script
SQL
1DECLARE @var nvarchar(1) -- too small variant length type
2DECLARE @var1 nchar(1) -- fixed length type
3DECLARE @var2 varchar(1) -- too small variant length type
4DECLARE @var3 char(1)-- fixed length type
5DECLARE @var4 nvarchar(2) -- too small variant length type
6DECLARE @var5 nchar(2) -- fixed length type
7DECLARE @var6 varchar(2) -- too small variant length type
8DECLARE @var7 char(2) -- fixed length type

Analysis Results

 MessageLineColumn
1SA0016 : Use of very small variable length type (size 1 or 2).122
2SA0016 : Use of very small variable length type (size 1 or 2).322
3SA0016 : Use of very small variable length type (size 1 or 2).523
4SA0016 : Use of very small variable length type (size 1 or 2).722
See Also

Other Resources