DF073: Table variable is used.
Last modified: June 12, 2025
The topic describes the DF073 T-SQL code analysis rule.
Category
BEST PRACTICE
Message
Table variable is used.
Description
It is not recommended to use table variables to store large amounts of data (more than 100 rows). Consider using a temporary table instead of a table variable.
Note
By default, the rule is turned off.
Additional information
Table variables are held in memory and are optimized for small-to-moderate result sets. Unlike temporary tables, they don’t support parallelism or advanced indexing, and their lack of statistics can prevent the query optimizer from making efficient execution choices.
Noncompliant code example
DECLARE @Tab TABLE(
CityId INT NOT NULL,
CityName VARCHAR(128) NOT NULL
);
INSERT INTO @Tab (CityId, CityName)
VALUES(1,'London');
GO
Compliant solution
CREATE TABLE #tab(
CityId INT NOT NULL,
CityName VARCHAR(128) NOT NULL
);
INSERT INTO #tab (CityId, CityName)
VALUES(1,'London');
GO
Want to find out more?
Overview
Take a quick tour to learn all about the key benefits delivered by dbForge Studio for SQL Server.
All features
Get acquainted with the rich features and capabilities of the tool in less than 5 minutes.
Request a demo
If you consider employing this tool for your business, request a demo to see it in action.