SA0263 : Temporary table is used before it has any data inserted |
![]() |
The topic describes the SA0263 analysis rule.

Temporary table is used before it has any data inserted

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.

Review the temporary table usage and ensure the table has any rows inserted before being referenced as a source table.

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

Rule has no parameters.

The rule does not need Analysis Context or SQL Connection.


Design Rules, Bugs

There is no additional info for this rule.

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 |

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 |
