지금 지원 담당자와 채팅
지원 담당자와 채팅

Toad for DB2 7.2 - Installation Guide

Example Script: Populate Tables and Data

The following script demonstrates how to use Toad Script functions. This script creates the number of tables you specify. The script prompts you for the number of tables to create and the number of rows to create.

For more information about Toad Script functions and how to use them, see About Toad Script.

--: PROMPT tableCount = 'Enter the number of test tables to create'

--: SET i = 0

--: WHILE i < tableCount

--: SET i = i + 1  

CREATE TABLE testTable{{Unquote(:i)}} ( id INT PRIMARY KEY );

--: ENDWHILE

--: NOTIFY 'Done creating tables.'

--: ASK addData = 'Fill tables with test data?'

--: IF addData

--: PROMPT rowCount = 'Enter number of rows to create'  

--: SET i = 0  

--: WHILE i < tableCount  

--: SET i = i + 1    

--: SET j = 1    

--: WHILE j <= rowCount    

INSERT INTOtestTable{{Unquote(:i)}} VALUES (:j);

--: SET j = j + 1      

--: ENDWHILE    

--: PRINT 'Completed filling table ' || i    

--: ENDWHILE  

--:ENDIF

 

관련 문서

The document was helpful.

평가 결과 선택

I easily found the information I needed.

평가 결과 선택