Groups | Blog | Home
all groups > sql server (alternate) > november 2004 >

sql server (alternate) : Batch insert 10000 rows at a time and commit


ajayz90 NO[at]SPAM hotmail.com
11/20/2004 5:29:27 AM
I want to Insert 10000 rows at a time and commit in sql server , Is
there a way to do it if the source tables have no id fields ?
What would be the most efficient method?

Thanks


John Bell
11/20/2004 7:41:47 PM
Hi

Bulk Insert/BCP have batch size parameters which will do this, although the
expect imput from data files. If the source is a table then you could set
rowcount and loop (if you can differentiate the records (there may be
another natural key) or possibly use a cursor to break the sizes down. There
are issues with rowcount and inserting from remote tables (see BOL (Topic:
ROWCOUNT) for more information)

John

[quoted text, click to view]

AddThis Social Bookmark Button