Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.databases.ms-sqlserver > #2092
| Path | csiph.com!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Anton Shepelev <anton.txt@g{oogle}mail.com> |
| Newsgroups | comp.databases.ms-sqlserver |
| Subject | UPDATE FROM |
| Date | Mon, 19 Jul 2021 12:14:48 +0300 |
| Organization | A noiseless patient Spider |
| Lines | 38 |
| Message-ID | <20210719121448.6ece4302949ccaaee268158c@g{oogle}mail.com> (permalink) |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=US-ASCII |
| Content-Transfer-Encoding | 7bit |
| Injection-Info | reader02.eternal-september.org; posting-host="dd0fec3c51854a8499957acc1fda1d80"; logging-data="18391"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19mQ65El3dW6w6hgZTplxF9ofCQFoxGw+I=" |
| Cancel-Lock | sha1:JqFLtHqvIUsCWbNH6uOnL86rLrw= |
| X-Newsreader | Sylpheed 3.5.0 (GTK+ 2.24.23; i686-pc-mingw32) |
| Xref | csiph.com comp.databases.ms-sqlserver:2092 |
Show key headers only | View raw
Hello, all. The MSSQL documentation for `UPDATE FROM' is not very clear on how the update source should be specified and how its rows are matched against those of the table being updated. I think the following methods are equivalent and correct: -- 1. UPDATE my_alias SET col = data_tab.col FROM upd_tab my_alias JOIN data_tab ON data_tab.code = my_alias.code -- 2. UPDATE upd_tab SET col = data_tab.col FROM upd_tab my_alias JOIN data_tab ON data_tab.code = my_alias.code But in some old code that seems to have been working for about ten years I have found an `UPDATE' with the following structure: -- 3. UPDATE upd_tab SET col = data_tab.col FROM data_tab WHERE data_tab.code = my_alias.code which, unlike the previous two commands, works non- deterministically, although there are no more than one row in data_tab from each row in upd_tab. Is it because the FROM clause does not mention upd_tab, whereas it must? If so, how is the WHERE predicate above interpreted and how does it affect the result? -- () ascii ribbon campaign - against html e-mail /\ http://preview.tinyurl.com/qcy6mjc [archived]
Back to comp.databases.ms-sqlserver | Previous | Next — Next in thread | Find similar
UPDATE FROM Anton Shepelev <anton.txt@g{oogle}mail.com> - 2021-07-19 12:14 +0300
Re: UPDATE FROM Anton Shepelev <anton.txt@g{oogle}mail.com> - 2021-07-19 12:23 +0300
Re: UPDATE FROM Anton Shepelev <anton.txt@g{oogle}mail.com> - 2021-07-19 17:21 +0300
Re: UPDATE FROM Erland Sommarskog <esquel@sommarskog.se> - 2021-07-19 20:52 +0200
Re: UPDATE FROM Anton Shepelev <antonius@freeshell.de> - 2021-07-20 17:12 +0300
csiph-web