|
Home > Archive > Microsoft SQL Server forum > July 2005 > Easy question on UPDATE
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Easy question on UPDATE
|
|
| Jeffrey Sheldon via SQLMonster.com 2005-07-27, 11:37 am |
|
I have one field organization_operati
ng_name that is on two tables vendor and
vendor_loc
I want to update the vendor name to the vendor_loc name
I tried this but get errors...
update vendor_loc
set organization_operati
ng_name = vendor. organization_operati
ng_name
where organization_operati
ng_name like 'DO NOT%'
Server: Msg 107, Level 16, State 3, Line 1
The column prefix 'vendor' does not match with a table name or alias name
used in the query.
vendor is a valid table name...so I must be missing something.
jeff
--
Message posted via http://www.webservertalk.com
| |
| Simon Hayes 2005-07-27, 11:37 am |
| See Example C under UPDATE in Books Online, and also "Changing Data
Using the FROM Clause".
Simon
| |
| Jeffrey Sheldon via SQLMonster.com 2005-07-27, 11:37 am |
|
thanks Simon,
the lightbulb went off....
Simon Hayes wrote:
>See Example C under UPDATE in Books Online, and also "Changing Data
>Using the FROM Clause".
>
>Simon
--
Message posted via http://www.webservertalk.com
| |
| --CELKO-- 2005-07-28, 9:24 am |
| UPDATE Vendor_Loc
SET organization_operati
ng_name
= (SELECT organization_operati
ng_name
FROM Vendors
WHERE organization_operati
ng_name LIKE 'DO NOT%');
You would never use the proprietary UPDATE .. FROM syntax because the
results are unpredictable. It will fail to discover cardinality
violations, does not port, and depends on the physical arrangment of
the data. .
|
|
|
|
|