Syntax (simplified)

UPDATE  <table_name>
SET <column_name> = {expression | DEFAULT | NULL}
FROM <table_source> [,...n]
WHERE <search_condition>


In the "FROM ... WHERE ..." construction is where you should place the
"other" table and the appropriate search conditions.

You can try this script to get a grip of it:

create table A (a int, b int)
create table B (c int, d int)

insert into A values (1,1)
insert into A values (2,1)
insert into A values (3,1)

insert into B values (1,4)
insert into B values (2,5)

update A set b = d
from B where a = c

select * from A
select * from B

drop table A
drop table B

>-----Original Message-----
>From: Conover, Ryan [mailto:[EMAIL PROTECTED]]
>Sent: Wednesday, February 07, 2001 4:26 PM
>To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
>Subject: [PHP-WIN] MS SQL Question
>
>
>I am trying to update a table with data from another table 
>within the same database with the following SQL
>
>UPDATE common SET common.[Extended Description] = extended.[Extended
>Description] WHERE common.[id] = extended.[Extended Description]
>
>the id is the primary key. I keep getting the following error.
>
>Server: Msg 107, Level 16, State 3, Line 1
>The column prefix 'extended' does not match with a table name 
>or alias name
>used in the query.
>Server: Msg 107, Level 16, State 1, Line 1
>The column prefix 'extended' does not match with a table name 
>or alias name
>used in the query.
>
>
>Anyone have any ideas.
>
>
>Ryan
>
>-- 
>PHP Windows Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: 
>[EMAIL PROTECTED]
>

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to