If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > simple loop to populate table with numbers

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-12-06, 18:21
bobjohnson360 bobjohnson360 is offline
Registered User
 
Join Date: Jan 2006
Posts: 15
simple loop to populate table with numbers

I need a very simple piece of code to populate a single
field in a table .I believe a loop could be used but not sure.

example:
id integer

1
2
3
4
5
6
thanks
BJ
Reply With Quote
  #2 (permalink)  
Old 01-12-06, 20:42
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
insert into table1
with temp(i) as
(
values(1)
union all
select i+1 from temp where i < 100
)
select * from temp


Quote:
Originally Posted by bobjohnson360
I need a very simple piece of code to populate a single
field in a table .I believe a loop could be used but not sure.

example:
id integer

1
2
3
4
5
6
thanks
BJ
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On