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)
 SELECT LEFT(ZZZT1..gl00105.actnumst, 15) as ZZZT1_

Author  Topic 

kelanhnan
Starting Member

1 Post

Posted - 2008-04-18 : 09:56:26
My sql statement is running fine in SQL 2000 but it I got the error when running it in SQL2005. The error is "Msg 1013, Level 16, State 1, Line 1
The objects "AL013..gl00105" and "ZZZT1..gl00105" in the FROM clause have the same exposed names. Use correlation names to distinguish them."


This is the SQL statement:


SELECT LEFT(ZZZT1..gl00105.actnumst, 15) as ZZZT1_actnumst,
LEFT(AL013..gl00105.actnumst,15) as AL013_actnumst

FROM ZZZT1..gl00105

RIGHT OUTER JOIN AL013..gl00105 ON
ZZZT1..gl00105.actnumst=AL013..gl00105.actnumst

where ZZZT1..gl00105.actnumst is null


--Checks the reverse relationship
SELECT LEFT(ZZZT1..gl00105.actnumst, 15) as ZZZT1_actnumst,
LEFT(AL013..gl00105.actnumst, 15) as AL013_actnumst

FROM AL013..gl00105

RIGHT OUTER JOIN ZZZT1..gl00105 ON
AL013..gl00105.actnumst=ZZZT1..gl00105.actnumst

where AL013..gl00105.actnumst is null

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-04-18 : 09:59:35
Try using aliases.I guess it cant distinguish between two tables:-

SELECT LEFT(t1.actnumst, 15) as ZZZT1_actnumst,
LEFT(t2.actnumst,15) as AL013_actnumst

FROM ZZZT1..gl00105 t1

RIGHT OUTER JOIN AL013..gl00105 t2 ON
t1.actnumst=t2.actnumst

where t1.actnumst is null


--Checks the reverse relationship
SELECT LEFT(t2.actnumst, 15) as ZZZT1_actnumst,
LEFT(t1.actnumst, 15) as AL013_actnumst

FROM AL013..gl00105 t1

RIGHT OUTER JOIN ZZZT1..gl00105 t2 ON
t1.actnumst=t2.actnumst
Go to Top of Page
   

- Advertisement -