Hi,
I have a table1 with new column that needs to be populated from table 2. Table1 has 350 million records in it.
Below is the code i am using... But it takes too long even to update the 1 million
DECLARE @BacthRecs int SET @BacthRecs = 1000000 WHILE @BacthRecs = 1000000 BEGIN UPDATE top ( 1000000 ) a SET a.NewColumn = isnull(t.Column1, 0.0000) FROM Table1 a with (NOLOCK) INNER JOIN Table2 t with (NOLOCK) on a.Year = t.Year and a.ZipCodeKey = t.ZipCodeKey WHERE a.year = '2013' SELECT @BacthRecs = @@ROWCOUNT END
Is there is any other way to make it fast? Please let me know. Any help is appreciated.
Thanks,
Punia