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 |
|
Ex
Posting Yak Master
166 Posts |
Posted - 2004-12-28 : 17:03:24
|
| Hello all this question is just out of interesti ran the execution plan over these 2 update statements and found they are actually identical which kind of puzzled medoes the first update statement do a JOIN as well ? cause i would of though at least there would be some differences in the execution plan or maybe some speed differencesam i right in assuming in their implementation they are identical speed wise? or would there be a difference in speeds over a large enough data set?1)UPDATE a SET myrow = i.myrowFROM my_Table a, inserted iWHERE a.pk1= i.pk1 AND a.pk2 = i.pk2 AND a.pk3 = i.pk3 AND dim.pk4 = i.pk42)UPDATE a SET myrow = i.myrowFROM my_Table aJOIN inserted i ona.pk1= i.pk1 AND a.pk2 = i.pk2 AND a.pk3 = i.pk3 AND dim.pk4 = i.pk4 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2004-12-28 : 17:06:30
|
| Yes the first does a JOIN as well. One way is the ANSI way, the other is the T-SQL way. I find that the JOIN way is easier to read. They will perform the same.Tara |
 |
|
|
LarsG
Constraint Violating Yak Guru
284 Posts |
Posted - 2004-12-30 : 07:16:02
|
| Neither of those queries are ANSI compliant. |
 |
|
|
derrickleggett
Pointy Haired Yak DBA
4184 Posts |
Posted - 2004-12-30 : 12:34:04
|
| Well, there is that. :) ANSI compliance doesn't support the aliased name of the table in the UPDATE. It can only be used in the FROM. blah, blah, blahMeanOldDBAderrickleggett@hotmail.comWhen life gives you a lemon, fire the DBA. |
 |
|
|
|
|
|