Chat now with support
Chat with Support

SQL Optimizer for SQL Server 10.1.2 - User Guide

Welcome to SQL Optimizer Optimize SQL
Create Optimize SQL Sessions Open Optimize SQL Sessions Rewrite SQL Plan Control Use Temporary Tables
Optimize Indexes Find SQL Scan SQL Manage Plan Guides Configure Options Tutorials About Us

Use Temporary Tables in Scan SQL

When SQL Scanner extracts INSERT, UPDATE, DELETE, or SELECT SQL statements, it determines if the statements access a temporary table. For statements that access a temporary table, SQL Scanner looks for a temporary table created previously to retrieve the execution plan. If a temporary table does not exist, SQL Scanner creates one automatically and uses it to retrieve the execution plan. All temporary tables are automatically dropped after the scanning process.

SQL Scanner automatically creates a temporary table for CREATE TABLE or SELECT INTO statements when you select the Create Scanner Temp Table checkbox in the Scanner Options page. If you clear this checkbox, SQL Scanner no longer creates temporary tables and classifies SQL statements that access temporary tables as invalid.See Scan SQL Options for more information.

You have the following options for how SQL Scanner handles temporary table creation:

  • SQL Scanner can use temporary tables you created using the Temp Table Manger or create new ones that override these user-defined temporary tables. Select the Override User-Defined Temp Tables checkbox in the Scanner Options page to have SQL Scanner override your previously created temporary tables.

  • SQL Scanner can use a new table definition each time it finds a new CREATE TABLE or SELECT INTO statement. Select the Override previous Scanner Temp Table checkbox in the Scanner Options page to have SQL scanner override temporary tables created previously by SQL Scanner.

Note: SQL Scanner uses the first CREATE TABLE or SELECT INTO statement it finds for each temporary table for all files and database objects associated with a scan job. If several SQL statements in a scan job use the same temporary table, SQL Scanner creates the temporary table for the first statement and uses the same table for the remaining statements.

  

Related Topics  

Create Temporary Tables

Scan Source Code with Temp Tables

Related Documents

The document was helpful.

Select Rating

I easily found the information I needed.

Select Rating