The text, ntext, and image data types are invalid in this subquery or aggregate expression.

  • SELECT p1.ProjectId, m.Step, DATEADD(hh, m.StepDeadLine, p1.CreatedDate) AS ddline, ISNULL

    ((SELECT TOP 1 u.UserId

    FROM Users AS u INNER JOIN

    Milestones_Constants AS mc ON u.Role = mc.ResponsibleRole INNER JOIN

    Projects AS p ON p.ProjectTypeId = mc.ProjectTypeId

    WHERE (p.ProjectId = p1.ProjectId) AND (mc.Step = m.Step) AND (NOT EXISTS

    (SELECT TaskId, UserId, FromDate, ToDate, Description, Personal, CreatedDate, TaskStatus, Notes, MileStoneId

    FROM Tasks

    WHERE (ISNULL(TaskStatus, 0) > 1) AND (UserId = u.UserId))) AND (u.Role <> (SELECT TOP 1 Role FROM Users WHERE (UserId = p1.OwnerId)))), p1.OwnerId) AS resid

    FROM Milestones_Constants AS m INNER JOIN

    Projects AS p1 ON m.ProjectTypeId = p1.ProjectTypeId

    WHERE (p1.ProjectId = 5)

  • Is there a question here?

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply