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, Bugs

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

  Message Line Column
1 SA0263 : Temporary table is used before it has any data inserted. 9 14
2 SA0263 : Temporary table is used before it has any data inserted. 11 12
3 SA0263 : Temporary table is used before it has any data inserted. 12 7
See Also

Other Resources