|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Re: Should I use indexes?select field1 ,field1 as field2 into TempTable1 from Table1 then drop Table1 and rename TempTable1 to Table1 would that work? But anyway, why do you need the same column twice? you can do select field1 ,field1 as field2 from Table1 if you need the same info but the column name has to be different Denis The SQL Menace http://sqlservercode.blogspot.com/ Erland Sommarskog wrote: Show quote > ngorbunov via SQLMonster.com (u9125@uwe) writes: > > I have a very large table (about 200,000 records), but there are only 2 > > fields in the table only one populated with data. I need to update the 2nd > > field with the first field's data. > > > > UPDATE Table1 > > SET field2 = field1 > > > > This is taking a really long time to run about 3.5 minutes. Is this > > normal? Can I create an index? What can I do to shorten the run time? > > 200000 rows is not a very large table. It's not even a large table. > > Unless, the columns are both varchar(MAX) with an average size of 10 MB, > then you have a (very) large table and 3.5 minutes for the update is not > so surprising. > > No, indexes is not going to help. Au contraire, since the indexes would > have to be maintained, things would run slower. > > But as Arnie said, the whole idea appears very funny. What's the point > with copying one column to the other? > > > -- > Erland Sommarskog, SQL Server MVP, esq***@sommarskog.se > > Books Online for SQL Server 2005 at > http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx > Books Online for SQL Server 2000 at > http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx |
|||||||||||||||||||||||