--CELKO-- (jcelko212 (AT) earthlink (DOT) net) writes:
Quote:
The answer is that it is verbose, but it works. The UPDATE..FROM
syntax is both proprietary and dangerous. |
Anything is dangerous. I've seen people wrong with the ANSI syntax as
well. I'd say it's even easier to go wrong with, because it much more
difficult to understand.
The purported problem with UPDATE FROM potentially qualifying multiple
rows is a red herring. If you feel compelled to write:
UPDATE tbl
SET col = (SELECT ...
You shouldn't use FROM in a SELECT either, or at least for one
table:
SELECT col = (SELECT ...
FROM tbl
If you join with incomplete conditions, you could get multiple rows
and cause a mess.
There is a nice beauty in the FROM clause for UPDATE: it makes the
language simpler to use, because the same construct is reused.
And this newsgroup is about SQL Server, and when it comes to SQL
Server, FROM is good practice, because it often gives much better
performance than the other syntax.
--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp