Ive this query I'm trying to execute with another store procedure but I need this query to be in string form Here is the query, It gives error on - and parenthesis and some other stuff tried but can't fix it,
[GetWorkOrderReport]('Select w.WorkOrderId,c.CompanyId + '-'+ ISNULL(CAST(w.WorkOrderNumber As nvarchar),'')
As WorkOrderDisplayId,
c.CompanyName, j.LocationId, w.CustomerId,
j.Name As JobSiteName, j.Street_Address as ''Address'',
j.LocationId As SiteNumber,j.City,j.StateCode,p.Name As PriorityName, u.FirstName +' '+
u.LAstName As DispatcherName,w.PONumber,w.BriefDescription,w.StatusId, w.RequestType,
w.NTE,j.Email,dbo.GetCommaSeperatedTrades(w.workorderId) As Trade,
CAST(w.DatePromised As DATE) As DatePromised,CAST(w.DateCompleted As DATE) As DateCompleted,
CAST(w.ModifiedDate As DATE) As ModifiedDate,CAST(w.CreatedDate As DATE) As DateReceived
from workorder w ...
Go to the complete details ...