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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 breaking update query

Author  Topic 

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2007-08-13 : 11:58:08
There is a table with a lot of fields.
An update query is written such as the following lines:

update
table1
set
field1 = table2.field1,
field2 = table2.field2,
field3 = table2.field3,
.
.
.
where
sourcefile = 'filename.csv'
and table1.field25 = table2.field25

Questions:

1)
Is it best to have an inner join update instead? why?

2)
should I break down the update query into several smaller updates? why?

3)
Would any of the answers above speed up the update?

Thanks

ashley.sql
Constraint Violating Yak Guru

299 Posts

Posted - 2007-08-13 : 12:06:40
since you have the data why don't you try a few test cases urself.

create another test table and try the options you mentioned and see how the results change. and how the time changes.

using the inner join again depends on what sort of data you have.

Ashley Rhodes
Go to Top of Page

Jeff Moden
Aged Yak Warrior

652 Posts

Posted - 2007-08-14 : 00:30:44
You're missing a FROM in the UPDATE. Recommend you visit Books Online to see what the correct syntax for joined updates actually is.

--Jeff Moden
Go to Top of Page

Jeff Moden
Aged Yak Warrior

652 Posts

Posted - 2007-08-14 : 00:35:02
AND, no, you cannot reference a file this way. Better to import the file, anyway.

--Jeff Moden
Go to Top of Page
   

- Advertisement -