Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Error In Update

Author  Topic 

AsimKhaliq
Yak Posting Veteran

94 Posts

Posted - 2004-03-16 : 17:06:03
Hi
I have 2 tables Table1 and Table 2. I want to copy address2 of table2 to address1 of table1 and i wrote this query but its not working.

UPDATE Table1
SET T1.address1 = T2.address2
FROM Table1 T1, Table2 T2
WHERE T1.CustomerCode = T2.CustomerCode

But when i run this query i have the following error
Cannot use the column prefix 'T1'. This must match the object in the UPDATE clause 'Table1'

drymchaser
Aged Yak Warrior

552 Posts

Posted - 2004-03-16 : 17:12:23
Try:

UPDATE T1
SET T1.address1 = T2.address2
FROM Table1 T1, Table2 T2
WHERE T1.CustomerCode = T2.CustomerCode
Go to Top of Page
   

- Advertisement -