LINQ to Entites - Left Outer Join - SQL 2000
Posted
by user255234
on Stack Overflow
See other posts from Stack Overflow
or by user255234
Published on 2010-04-06T15:22:31Z
Indexed on
2010/04/06
15:23 UTC
Read the original article
Hit count: 229
linq-to-entities
Hi!
I'm using Linq to Entities. I have the following query in my code, it includes left outer Join:
var surgeonList = (from item in context.T1_STM_Surgeon.Include("T1_STM_SurgeonTitle")
.Include("OTER").Include("OSLP")
join reptable in context.OSLP on item.Rep equals reptable.SlpCode into surgRepresentative
where item.ID == surgeonId
select new
{ ID = item.ID, First = item.First, Last = item.Last, Rep = (surgRepresentative.FirstOrDefault() != null) ? surgRepresentative.FirstOrDefault().SlpName : "N/A", Reg = item.OTER.descript, PrimClinic = item.T1_STM_ClinicalCenter.Name, Titles = item.T1_STM_SurgeonTitle, Phone = item.Phone, Email = item.Email, Address1 = item.Address1, Address2 = item.Address2, City = item.City, State = item.State, Zip = item.Zip, Comments = item.Comments, Active = item.Active, DateEntered = item.DateEntered
}) .ToList();
My DEV server has SQL 2008, so the code works just fine. When I moved this code to client's production server - they use SQL 2000, I started getting "Incorrect syntax near '(' ".
I've tried changing the ProviderManifestToken to 2000 in my .edmx file, then I started getting "The execution of this query requires the APPLY operator, which is not supported in versions of SQL Server earlier than SQL Server 2005." I tied changing the token to 2005, the "Incorrect syntax near '(' " is back.
Can anybody help me to find a workaround for this?
Thank you very much in advance!
© Stack Overflow or respective owner