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 2005 Forums
 Transact-SQL (2005)
 How to solve the ambiguos error message while upda

Author  Topic 

pras2007
Posting Yak Master

216 Posts

Posted - 2009-09-25 : 10:00:37
Hello All,

I want to update the testing table and I’m getting the below error:

Msg 8154, Level 16, State 1, Line 1
The table 'TESTING' is ambiguous.

I ready tried update A and did not work, does anyone know how to rewrite the update statement it could work?



update TESTING
set
INCC = (A.IPC - B.IPC)
,EPCC = (A.EPC- B.EPC)
,TOIRC = (A.TOIR - B.TOIR)
,TOERC = (A.TOER - B.TOER)
,TIC = (A.TI - B.TI)
,TIIC = (A.TII - B.TII)
,TEIC = (A.TEI- B.TEI)
,TPCC = (A.TPCC - B.TPCC)
from testing A inner join testing B on A.ccid = B.ccid and A.ilcd = B.ilcd
and B.Edate = A.PEdate
WHERE A.PEdate>=dateadd(mm,-2,getdate())
and A.PRdate<dateadd(mm,0,getdate())

Please advice.

rocknpop
Posting Yak Master

201 Posts

Posted - 2009-09-25 : 10:05:06
update A in place of update TESTING


--------------------
Rock n Roll with SQL
Go to Top of Page
   

- Advertisement -