立即与支持人员聊天
与支持团队交流

SQL Optimizer for SAP ASE 3.9.1 - User Guide

Introduction Tutorials Preferences Editor Functions SQL Information and Functions Performance Monitor SQL Inspector SQL Collector for Monitor Server SQL Scanner Index Advisor SQL Optimizer
SQL Optimizer Overview Optimization Engine Common Coding Errors in SQL Statements What Function Should l Use to Retrieve the Run Time? Unsatisfactory Performance Results SQL Optimizer Functions SQL Editor Optimized SQL Activity Log
SQL Worksheet SQL Formatter Database Explorer Code Finder Object Extractor SQL Repository Index Impact Analyzer Index Usage Analyzer Configuration Analyzer Migration Analyzer Abstract Plan Manager User-Defined Temp Tables SQL History Legal Information

Parameters in Temporary Table SQL

In the User-Defined Temp Table window, if the commands for creating the temporary table contain parameters, you are prompted to enter the data types and values on the Parameters window after you click Execute.

 

Related Topics

View SQL scripts of temporary tables

After the user-defined temporary tables are created, you can view the SQL scripts used to create and populate the tables.

To view a script

  1. Click image\B_UserDefinedTempTable.gif.

  2. Select the Temp Table List tab.

  3. Select the temporary table from the Temp Table drop down list.

 

Related Topics

Drop Temporary Tables

After the User-Defined temporary tables are created, you can drop them.

To drop temporary tables

  1. Click .

  2. Select the Temp Table List tab.

  3. If you want to remove all temp tables, click Drop All Table.

 

Related Topics

Example of Temporary Tables in SQL Scanner

Example with CREATE TABLE in the source code containing the following SQL statements:

/* SQL1 */

CREATE TABLE #temp1

([EMP_ID] float NOT NULL,

[EMP_NAME] varchar (40) NOT NULL)

 

/* SQL2 */

Insert into #temp1 (EMP_ID, EMP_NAME)

values (1, 'Rene')

 

/* SQL3 */

Insert into #temp1 (EMP_ID, EMP_NAME)

values (2, 'Andrew')

 

/* SQL4 */

Insert into #temp1 (EMP_ID, EMP_NAME)

values (3, 'Claudia')

 

/* SQL5 */

Select * from #temp1

In the above example, when the SQL Scanner finds the first INSERT statement, it executes the CREATE TABLE statement, so that the temporary table #temp1 is created. The query plan for the INSERT statement is obtained and the statement is classified as to how likely it is to be causing a performance problem. In the SQL Information Pane of the SQL Scanner window, the Scanner Temp Table pane displays the SQL statements used to create the temporary table. At then end of scanning process, the temporary table is dropped unless you have set the Override User-Defined Temp Table option.

In the Preferences, an option is provided to include the data in the temporary table. When you select the Include data option, the INSERT, UPDATE and DELETE statements that populate the temporary table are also executed. These statements are displayed along with the CREATE TABLE command in the Information Pane in the SQL Scanner window.

From the example above, the SQL Scanner window shows the following for SQL5 (select * from #temp1) under the Scanner Temp Table button. It shows the SQL statement used to create the temporary table and the data that is inserted into it during the scanning process.

/* with Included data option selected in Preferences */

CREATE TABLE #temp1

([EMP_ID] float NOT NULL,

[EMP_NAME] varchar (40) NOT NULL)

Insert into #temp1 (EMP_ID, EMP_NAME)

values (1,'Rene')

Insert into #temp1 (EMP_ID, EMP_NAME)

values (2,'Andrew')

Insert into #temp1 (EMP_ID, EMP_NAME)

values (3,'Claudia')

Example using SELECT INTO to create the temporary table.

After scanning, the SQL Scanner window shows the following two statements:

/* SQL1 */

select EMP_ID,

EMP_NAME

into #temp1

from EMPLOYEE

 

/* SQL2 */

select *

from #temp1

 

For SQL2, the Scanner Temp Table pane shows that the SELECT INTO SQL statement was used to create the temporary table.

select EMP_ID,

EMP_NAME

into #temp1

from EMPLOYEE

 

Related Topics

相关文档

The document was helpful.

选择评级

I easily found the information I needed.

选择评级