Answered by:
SQL Query To Linq

Question
-
Please Convert this sql query to Linq
******************************
SELECT DISTINCT deoChild.ChildID,
deoChild.LastName + ', ' + deoChild.FirstName as [ChildName],
deoChild.DOB, deoChild.OSISID,
COALESCE(deoChild.Add1, '') + COALESCE(', ' + deoChild.Add2, '') + COALESCE(', ' + deoChild.City, '') + COALESCE(', ' + deoChild.State, '') + COALESCE(' ' + deoChild.Zip, '') as [ChildAddress],
doeSer.ServiceID, doeSer.SchoolID,
doeSer.DistrictNum, doeSer.RegionNum,
doeSer.SchoolNum, doeSer.SchoolName,
doeSer.SchoolYear, doeSer.ProgramDesc,
doeSer.SvcSiteName, doeSer.SvcGroupName,
doeSer.SvcTypeID, doeSer.SvcName, doeSer.SvcCode,
doeSer.AgencyBegin, doeSer.AgencyEnd, doeSer.Terminated,
doeSer.Days, doeSer.Mins, doeSer.Weeks, doeSer.Units, doeSer.GroupSize,
doeSer.ClinicianID, doeSer.AssignmentBegin, doeSer.AssignmentEnd,
doeSer.AssignmentTime, doeSer.DateAssigned, doeSer.PayableRate,
clin.LastName + ', ' + clin.FirstName as [ClinicianName]
FROM [doeChild] as deoChild, [doeService] as doeSer, Clinician as clin
WHERE deoChild.ChildID = doeSer.ChildID
AND doeSer.ClinicianID = clin.ClinicianID
AND clin.ClinicianID = 7866
AND DATEDIFF(Day, doeSer.AgencyEnd, getdate()) <= 665
AND DATEDIFF(Day, doeSer.AssignmentEnd, getdate()) <= 665
ORDER BY doeSer.SchoolNum, doeSer.SchoolName, deoChild.LastName + ', ' + deoChild.FirstName, deoChild.DOB, deoChild.OSISID
G.Palanikumar- Edited by G.Palanikumar Monday, September 5, 2011 11:07 AM
Monday, September 5, 2011 11:06 AM
Answers
-
Hi,
I think you can try to run command text in LINQ or EF directly without tranform it.
http://msdn.microsoft.com/en-us/library/bb399403.aspx
Have a nice day.
Alan Chen[MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
- Marked as answer by Alan_chen Monday, October 3, 2011 7:43 AM
Monday, September 5, 2011 1:51 PM
All replies
-
Hi,
May be this tool could help you:
Best regards,
JA Reyes.
Please remember to Vote & "Mark As Answer" if this post is helpful to you.
Por favor, recuerda Votar y "Marcar como respuesta" si la solución de esta pregunta te ha sido útil.Monday, September 5, 2011 11:21 AM -
Hi,
I think you can try to run command text in LINQ or EF directly without tranform it.
http://msdn.microsoft.com/en-us/library/bb399403.aspx
Have a nice day.
Alan Chen[MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
- Marked as answer by Alan_chen Monday, October 3, 2011 7:43 AM
Monday, September 5, 2011 1:51 PM