I have a table with 3.5million records and i have one IDNO field with
primary key. I want to you update a field with substring of another..
e.g.
Update table
set field2 = substring(field1,1,2)
I ran the following script
DECLARE MyUpdate CURSOR
READ_ONLY
FOR SELECT table1.idno FROM table1 WITH (NOLOCK)
OPEN MyUpdate
BEGIN
BEGIN
UPDATE TABLE1
SET FIELD2 = SUBSRTING(FIELD1,1,2)
END
END
CLOSE MyUpdate
DEALLOCATE MyUpdate
GO
I had it run over night and it then I finally had to cancel it in the
morning becuase it was still running.. I checked and it only updated 320,000
records in 15 hours... Less than 10%..
Any ideas how i can super speed this up is appreciated.
Divyesh