Re: Updating several fields in a table with a select statement
From: Hugo Kornelis (hugo_at_pe_NO_rFact.in_SPAM_fo)
Date: 11/29/04
- Next message: Yaocuauhtzin: "Re: SQL 2000 fails to detect NULL values"
- Previous message: Anith Sen: "Re: How to FTP via VPN to sites with real adresses on different IP's ?"
- In reply to: Chip: "Updating several fields in a table with a select statement"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 29 Nov 2004 22:59:47 +0100
On Mon, 29 Nov 2004 10:09:18 -0800, Chip wrote:
>Hi,
>
>Is there a way in T-SQL to update several fields of a table with fields from
>another table using a select statement based on a key? I remember doing that
>in Oracle. If so, can you please give me the syntax. Thanks.
Hi Chip,
Is this the syntax you are looking for?
UPDATE a
SET Column1 = b.Column1,
....
ColumnN = b.ColumnN
FROM FirstTable AS a
INNER JOIN SecondTable AS b
ON b.??? = a.???
WHERE ....
Note that this syntax is proprrietary T-SQL, not ANSI-standard, and
therefore not portable to other platforms. Note also that the results may
not be as expected if a row in FirstTable matches more than one row in
SecondTable.
Best, Hugo
-- (Remove _NO_ and _SPAM_ to get my e-mail address)
- Next message: Yaocuauhtzin: "Re: SQL 2000 fails to detect NULL values"
- Previous message: Anith Sen: "Re: How to FTP via VPN to sites with real adresses on different IP's ?"
- In reply to: Chip: "Updating several fields in a table with a select statement"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|