How to creat tables using record ID in for loop
От | CHUNRIMACHUNRIMA |
---|---|
Тема | How to creat tables using record ID in for loop |
Дата | |
Msg-id | BLU108-W46237DAA123B80A93E9DF4C87A0@phx.gbl обсуждение исходный текст |
Ответы |
Re: How to creat tables using record ID in for loop
Re: How to creat tables using record ID in for loop |
Список | pgsql-sql |
1. I have created the first table and inserted records as below<br />CREATE TABLE mytest (<br /> staid varchar(20),<br/> kdesc varchar(50) -- description of gage station <br /> )<br /> WITHOUT OIDS;<br /><br/><br /> INSERT INTO mytest VALUES ('96784002', 'mylocation #1');<br />INSERT INTO mytest VALUES ('02385067', 'mylocation#2');<br />INSERT INTO mytest VALUES ('01734056', 'mylocation #3');<br />INSERT INTO mytest VALUES ('04784097','mylocation #4');<br />INSERT INTO mytest VALUES ('16784201', 'mylocation #5');<br /><br /> 2. The records looklike this.<br /><br /> SELECT * FROM mytest;<br /><br /> ++++++++++++++++++++++++++<br />"96784002";"mylocation #1"<br/>"02385067";"mylocation #2"<br />"01734056";"mylocation #3"<br />"04784097";"mylocation #4"<br />"16784201";"mylocation#5"<br />++++++++++++++++++++++++++<br /><br /> 3. What I want to do is to create tables with staidfrom mytest table using for loop.<br />But, since the name of tables should be in text format, I added a string 's'to staid. <br />Thus, the name of table should be like this s96784002 because of 's' +'staid'.<br /><br />+++Example+++<br/><br /> CREATE TABLE s06784000 (<br /> staid varchar(50),<br /> val real, -- streamflow<br /> date date<br />)<br /><br /> WITHOUT OIDS;<br /><br /><br /><br /> 4. I mustcreate tables using for loop because I have millions of records. <br /><br />I appreciate your help in advance. <br /><br/><br />Jae<br /><br /><br /><br /><br /><hr />강력해진 보안성, 아웃룩을 닮아 편리해진 기능들로 무장한 Windows Live Hotmail! <a href="http://www.hotmail.com"target="_new">뜨거운 메일 핫메일, Windows Live Hotmail로 돌아오다!</a>
В списке pgsql-sql по дате отправления: