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
 SQL Server Development (2000)
 Table alisases for UPDATE statement

Author  Topic 

tribune
Posting Yak Master

105 Posts

Posted - 2005-10-04 : 18:27:19
[code]
update TableA A set
A.Field1 = B.Field1
from
TableB B
where
A.Field2 = B.Field2
[/code]

This doesn't work unless I remove the alias for TableA. How do you alias a table with this statement? Thanks

nathans
Aged Yak Warrior

938 Posts

Posted - 2005-10-04 : 18:47:42
[code]update a
set field1 = b.field1
from tableA a
inner join tableB
on a.field2 = b.field2[/code]

Nathan Skerl
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-10-05 : 00:36:15
quote:
Originally posted by nathans

update a
set field1 = b.field1
from tableA a
inner join tableB
on a.field2 = b.field2


Nathan Skerl


Small Correction
update a
set field1 = b.field1
from tableA a
inner join tableB b
on a.field2 = b.field2


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

nathans
Aged Yak Warrior

938 Posts

Posted - 2005-10-05 : 00:45:54
Doh!

Good catch

Nathan Skerl
Go to Top of Page

tribune
Posting Yak Master

105 Posts

Posted - 2005-10-05 : 01:52:06
thanks!
Go to Top of Page
   

- Advertisement -