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
 Express Edition and Compact Edition (2005)
 help required urgently

Author  Topic 

parikshitnigam
Starting Member

1 Post

Posted - 2008-11-08 : 18:48:04

hi all
this is a join and i am getting following error even though all the variables are declared and all table does exists in data base. i am using sql server 2005. please help me.
thanks in advance.
Msg 107, Level 16, State 2, Line 33
The column prefix 'dbo.SorDetail' does not match with a table name or alias name used in the query.
Msg 107, Level 16, State 2, Line 33
The column prefix 'dbo.PromoHistory' does not match with a table name or alias name used in the query.


FROM (SysproCompany1.dbo.SalSalesperson RIGHT JOIN
((SysproCompany1.dbo.SorDetail INNER JOIN SysproCompany1.dbo.SorMaster
ON SysproCompany1.dbo.SorDetail.SalesOrder = SysproCompany1.dbo.SorMaster.SalesOrder)
LEFT JOIN SunHistoryS.dbo.PromoHistory ON (SysproCompany1.dbo.SorDetail.SalesOrder = SunHistoryS.dbo.PromoHistory.OrderNum)
AND (SysproCompany1.dbo.SorDetail.SalesOrderLine = dbo.PromoHistory.LineNum)) ON
(SysproCompany1.dbo.SalSalesperson.Branch = SysproCompany1.dbo.SorMaster.Branch) AND
(SysproCompany1.dbo.SalSalesperson.Salesperson = SysproCompany1.dbo.SorMaster.Salesperson))
LEFT JOIN SysproCompany1.dbo.SalArea ON
SysproCompany1.dbo.SorMaster.Area = SysproCompany1.dbo.SalArea.Area
WHERE (((SysproCompany1.dbo.SorMaster.Customer)<>' ') AND
((SysproCompany1.dbo.SorMaster.ReqShipDate)
Between @frmdate And @todate) AND ((SysproCompany1.dbo.SorMaster.Area)='MI'
Or (SysproCompany1.dbo.SorMaster.Area)='RE' Or (SysproCompany1.dbo.SorMaster.Area)='FS' Or (SysproCompany1.dbo.SorMaster.Area)='DM' Or
(SysproCompany1.dbo.SorMaster.Area)='EX' Or (SysproCompany1.dbo.SorMaster.Area)=" " Or (SysproCompany1.dbo.SorMaster.Area)='IN') AND
((SysproCompany1.dbo.SorMaster.SalesOrder) Not Like '8*' And (SysproCompany1.dbo.SorMaster.SalesOrder) Not Like '9*')
AND ((SysproCompany1.dbo.SorMaster.OrderStatus)='9') AND ((SysproCompany1.dbo.SorDetail.LineType)='1'));

darkdusky
Aged Yak Warrior

591 Posts

Posted - 2008-11-10 : 05:02:42
Verify you are querying the correct database, i.e put 'USE' followed by Databasename at top of query, or select the correct database from dropdown list.
Go to Top of Page
   

- Advertisement -