bulk update

19/08/2005 - 06:14 por vijay | Informe spam
Platform: SQL Server 2000

-



Hi,

I have created database which has million records. Lets a table [table1]
which has 100,000 records. Let a key field [field1] has value from 1 to
100,000. I need to change it from 100,001 to 200,000

i.e.

1 to 100,001

2 to 100,002

3 to 100,003 and so on.



To change I am executing following update sql



UPDATE [table1] set [field1] = 100001 where field1=1, to change [field1]
value from 1 to 100001.



To update 100,000 records I need to execute update sql 100,000 times. I want
to know IS THERE ANY FASTEST WAY to do same. It will be appreciated for any
help.



Regards

vijay
 

Leer las respuestas

#1 Alejandro Mesa
19/08/2005 - 14:51 | Informe spam
Try:

UPDATE [table1]
set [field1] = [field1] + 100000


AMB

"vijay" wrote:

Platform: SQL Server 2000

-



Hi,

I have created database which has million records. Lets a table [table1]
which has 100,000 records. Let a key field [field1] has value from 1 to
100,000. I need to change it from 100,001 to 200,000

i.e.

1 to 100,001

2 to 100,002

3 to 100,003 and so on.



To change I am executing following update sql



UPDATE [table1] set [field1] = 100001 where field1=1, to change [field1]
value from 1 to 100001.



To update 100,000 records I need to execute update sql 100,000 times. I want
to know IS THERE ANY FASTEST WAY to do same. It will be appreciated for any
help.



Regards

vijay









Preguntas similares