Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Lopaka
Starting Member
48 Posts |
Posted - 2009-12-15 : 14:16:02
|
I created a simple Int field in a table with 26 million rows. Tried to populate the field incrementally: Update Table Set Field = @i + field + @i + 1Let it run for 9 hours, still didn't finish. I then tried the same thing, but updated a field with NULL. Same thing.Question is, is there something I am doing wrong or is there something wrong with the database?Thank youRobert R. Barnes |
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2009-12-15 : 14:35:39
|
First, what are you trying to accomplish? Number the records from 1 to 26 million...? If so, make the field an identity columnALTER TABLE yourTableADD id int identity(1, 1) not null Also, your actual script would be helpful, instead of only a part of it |
 |
|
Lopaka
Starting Member
48 Posts |
Posted - 2009-12-15 : 14:56:05
|
here is the actual script:ALTER TABLE table ADD PK INT NULLgo-- Populate the new Primary KeyDECLARE @i INTSET @i = 0UPDATE tableSET @i = PK = @i + 1Changed the int to an identity, however i think it will result in the same duration...:( Robert R. Barnes |
 |
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2009-12-15 : 15:05:03
|
I doubt it. But make sure nothing is blocking it by executing sp_who2 in a seperate query window. |
 |
|
|
|
|