1. I have created the first table and inserted records as below
CREATE TABLE mytest (
    staid varchar(20),
    kdesc  varchar(50)          -- description of gage station 
    )
    WITHOUT OIDS;







INSERT INTO mytest VALUES ('96784002', 'mylocation #1');
INSERT INTO mytest VALUES ('02385067', 'mylocation #2');
INSERT INTO mytest VALUES ('01734056', 'mylocation #3');
INSERT INTO mytest VALUES ('04784097', 'mylocation #4');
INSERT INTO mytest VALUES ('16784201', 'mylocation #5');


2. The records look like this.

SELECT * FROM mytest;







++++++++++++++++++++++++++
"96784002";"mylocation #1"
"02385067";"mylocation #2"
"01734056";"mylocation #3"
"04784097";"mylocation #4"
"16784201";"mylocation #5"
++++++++++++++++++++++++++


3. What I want to do is to create tables with staid from mytest table using for 
loop.But, since the name of tables should be in text format, I added a string 
's' to staid. 
Thus, the name of table should be like this s96784002 because of 's' +'staid'.


+++Example+++





CREATE TABLE s06784000 (
    staid   varchar(50),
    val            real,          -- streamflow
    date            date)

WITHOUT OIDS;



4. I must create tables using for loop because I have millions of records. 
I appreciate your help in advance. 

Jae

 
_________________________________________________________________
강력해진 보안성, 아웃룩을 닮아 편리해진 기능들로 무장한 Windows Live Hotmail! 지금 로그인해 보세요!
http://www.hotmail.com

Reply via email to