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 |
|
mtlondon
Starting Member
2 Posts |
Posted - 2010-11-04 : 08:02:36
|
| HiI have 2 tables, one is a wide version with name and address info and the other is a deep version with other profile info.I have deduped the name and address table, and now have a contact urn, i need to update the deep table with this.The link between 2 tables at present is an SRN field and source name, I need to update the contact urn, but would need to run in batches as there are millions of records to update. I have indexes on both tables, but the query seems to take too long to run and uses up all the space.my code is declare @i int,@stop int select @i = MIN(SRN),@stop = MAX(SRN)from URNs while @i < @stopbegin update a set a.PURN = b.PURN, a.AURN = b.AURN, a.EURN = b.EURN from other a, URNs b where a.Source = b.Source and a.SRN = b.SRN and a.PURN is null and b.SRN in (select top 5000 SRN from URNs where SRN >= @i order by SRN ) set @i = @i + 5000 delete from URNs where SRN < @i end |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
|
|
|
|
|