Click to See Complete Forum and Search --> : How to fill table with many of identity values?


Sonin Nickolay
May 17th, 2004, 04:57 AM
I created table

create table t1
(
oid int identity(1, 1),
f tinyint
)

and need way to fill it as fast as possible with say 100000 sequential values. Field f may stay = 0 but oid should be raising from row to row. How can I do it in MSSQL 2000?

hspc
May 17th, 2004, 05:25 AM
slow but working

set nocount on
declare @n int
set @n=0
while @n<100000
begin
insert into #t1 DEFAULT VALUES
set @n=@n+1
End
SET NOCOUNT OFF

Sonin Nickolay
May 17th, 2004, 05:28 AM
Originally posted by hspc
slow but working

set nocount on
declare @n int
set @n=0
while @n<100000
begin
insert into #t1 DEFAULT VALUES
set @n=@n+1
End
SET NOCOUNT OFF


I know it and have tested it. Too slowly - about 30 sec on my PII-400 256