the error i keep getting is
Server: Msg 306, Level 16, State 2, Line 1
The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator.
Not sure why it is throwing up error but a bit rusty on my sql
code is
SELECT
[JobRecords].[JobID],
[JobRecords].[DateTimeCreated],
[ContractType].[ContractTypeName],
[CustomerContracts].[CompanyName],
[CustomerContracts].[UnitsRemaining],
[CoveredSites].[SiteName],
[JobRecords].[Description],
[JobRecords].[Status],
[ProblemCategory].[ProblemCategory],
[ActionRequired].[Action],
[JobRecords].[PriorityID],
[Priority].[Priority],
IsNull( convert(int , Sum(FurtherJobDetails.UnitsUsed) ) ,0) AS SumOfUnitsUsed
FROM (ProblemCategory INNER JOIN (Priority INNER JOIN ((ContractType INNER JOIN CustomerContracts ON ContractType.ContractTypeID = CustomerContracts.ContractTypeID) INNER JOIN (CoveredSites INNER JOIN (ActionRequired INNER JOIN JobRecords ON ActionRequired.ActionID = JobRecords.ActionID) ON CoveredSites.SiteID = JobRecords.SiteID) ON CustomerContracts.CustomerID = CoveredSites.CustomerID) ON Priority.PriorityID = JobRecords.PriorityID) ON ProblemCategory.ProbCatID = JobRecords.ProbCatID) LEFT JOIN FurtherJobDetails ON JobRecords.JobID = FurtherJobDetails.JobID
WHERE (((CustomerContracts.CustomerID)= 1) AND ((JobRecords.Status) Like 'Open'))
GROUP BY
[JobRecords].[JobID],
[JobRecords].[DateTimeCreated],
[ContractType].[ContractTypeName],
[CustomerContracts].[CompanyName],
[CustomerContracts].[UnitsRemaining],
[CoveredSites].[SiteName],
[JobRecords].[Description],
[JobRecords].[Status],
[ProblemCategory].[ProblemCategory],
[ActionRequired].[Action],
[JobRecords].[PriorityID],
[Priority].[Priority]
ORDER BY JobRecords.JobID
Server: Msg 306, Level 16, State 2, Line 1
The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator.
Not sure why it is throwing up error but a bit rusty on my sql
code is
SELECT
[JobRecords].[JobID],
[JobRecords].[DateTimeCreated],
[ContractType].[ContractTypeName],
[CustomerContracts].[CompanyName],
[CustomerContracts].[UnitsRemaining],
[CoveredSites].[SiteName],
[JobRecords].[Description],
[JobRecords].[Status],
[ProblemCategory].[ProblemCategory],
[ActionRequired].[Action],
[JobRecords].[PriorityID],
[Priority].[Priority],
IsNull( convert(int , Sum(FurtherJobDetails.UnitsUsed) ) ,0) AS SumOfUnitsUsed
FROM (ProblemCategory INNER JOIN (Priority INNER JOIN ((ContractType INNER JOIN CustomerContracts ON ContractType.ContractTypeID = CustomerContracts.ContractTypeID) INNER JOIN (CoveredSites INNER JOIN (ActionRequired INNER JOIN JobRecords ON ActionRequired.ActionID = JobRecords.ActionID) ON CoveredSites.SiteID = JobRecords.SiteID) ON CustomerContracts.CustomerID = CoveredSites.CustomerID) ON Priority.PriorityID = JobRecords.PriorityID) ON ProblemCategory.ProbCatID = JobRecords.ProbCatID) LEFT JOIN FurtherJobDetails ON JobRecords.JobID = FurtherJobDetails.JobID
WHERE (((CustomerContracts.CustomerID)= 1) AND ((JobRecords.Status) Like 'Open'))
GROUP BY
[JobRecords].[JobID],
[JobRecords].[DateTimeCreated],
[ContractType].[ContractTypeName],
[CustomerContracts].[CompanyName],
[CustomerContracts].[UnitsRemaining],
[CoveredSites].[SiteName],
[JobRecords].[Description],
[JobRecords].[Status],
[ProblemCategory].[ProblemCategory],
[ActionRequired].[Action],
[JobRecords].[PriorityID],
[Priority].[Priority]
ORDER BY JobRecords.JobID