Click or drag to resize

SA0263 : Temporary table is used before it has any data inserted

The topic describes the SA0263 analysis rule.

Message

Temporary table is used before it has any data inserted

Description

The rule checks T-SQL code for create temporary tables statements, where the particular table is never inserted or is referenced as source table before previously appearing as target table in INSERT,SELECT INTO or MERGE statements, or as output table in OUTPUT INTO clause.

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

Design Rules, New Rules

Additional Information

There is no additional info for this rule.

Example Test Script
SQL
 1CREATE TABLE #mail
 2(      
 3        toAddress NVARCHAR( 100 ) ,
 4        fromAddres NVARCHAR( 100 ) ,
 5        subject NVARCHAR( 256 ) ,
 6        body NVARCHAR( 4000 )
 7);
 8
 9SELECT * FROM #mail
10
11DELETE FROM #mail
12UPDATE #mail set  toAddress =''
13
14INSERT INTO #mail
15SELECT * from mail 
16
17SELECT * FROM #mail

Analysis Results

 MessageLineColumn
1SA0263 : Temporary table is used before it has any data inserted.914
2SA0263 : Temporary table is used before it has any data inserted.1112
3SA0263 : Temporary table is used before it has any data inserted.127
See Also

Other Resources