2012年2月13日星期一

Batch insert 10000 rows at a time and commit

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

AjayHi

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

"Ajay Garg" <ajayz90@.hotmail.com> wrote in message
news:d9477327.0411200529.4cfc0386@.posting.google.c om...
>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
>
> Ajay

没有评论:

发表评论