Thread: Creating blank records with sequential record numbers

Creating blank records with sequential record numbers

From
o.blomqvist@secomintl.com (Otto Blomqvist)
Date:
Hello!

I'm pretty sure this is an easy thing to do but I cant still figure
out how. I have a table with about 20 columns, one column being the
record_number. I want to insert 100'000 new records with 1, 2, 3, 4
... 100'000 in the record_number field. All the other columns can be
left at nulls or whatever the default is.

Right now I'm doing this using a "for" loop in my app. Not very fast
or smart

Any better ideas ?

Thanks

/Otto Blomqvist

Re: Creating blank records with sequential record numbers

From
"Scott Marlowe"
Date:
On Thu, 2004-08-05 at 12:55, Otto Blomqvist wrote:
> Hello!
>
> I'm pretty sure this is an easy thing to do but I cant still figure
> out how. I have a table with about 20 columns, one column being the
> record_number. I want to insert 100'000 new records with 1, 2, 3, 4
> ... 100'000 in the record_number field. All the other columns can be
> left at nulls or whatever the default is.
>
> Right now I'm doing this using a "for" loop in my app. Not very fast
> or smart
>
> Any better ideas ?

As long as you're wrapping it all into one big transaction, you're fine
using a for next loop.  Sure, you could probably write a pl function to
do it, but I can't see it being worth the development effort if you've
already got a script doing it.