SA0264 : Temporary table created but not used as table source
The topic describes the SA0264 analysis rule.
Temporary table created but not used as table source
The rule checks T-SQL code for temporary tables created, but not used as a table source in any FROM clause of following SELECT, UPDATE, DELETE or MERGE statements.
Review the code and the temporary table usages and remove it if is not really needed.
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, Code Smells
There is no additional info for this rule.
1CREATE TABLE #Greeting 2( 3GreetingId INT IDENTITY (1,1) PRIMARY KEY, 4Message nvarchar(255) NOT NULL, 5) 6 7SELECT * INTO #Greeting2 FROM dbo.Greeting 8 9INSERT INTO #Greeting (Message) 10SELECT 'Hello!' 11UNION ALL 12SELECT 'Hi!' 13UNION ALL 14SELECT 'Hello, world!' 15 16DELETE #Greeting WHERE GreetingId = 3 17 18-- SELECT * FROM #Greeting g WHERE g.Message like 'Hello%'
|1||SA0264 : Temporary table created but not used as table source.||1||13|
|2||SA0264 : Temporary table created but not used as table source.||7||14|