Here's a query that is part of some complex query with unions.
It works normally the way it is written; however, when I move the highlighted code to join (highlighted place), I start getting the error about Dtabase id 112 being wrong cause it's not activated or is in transition.
Why is that?
Code:
SELECT Email,'Mng' as Role
FROM resManager
INNER JOIN d10task.dbo.UserGroups ug ON resManager.GroupID = ug.GroupID
INNER JOIN resRequestResource ON resRequestResource.RequestID = @RequestID
INNEr JOIN resResource ON resRequestResource.ResourceID = resResource.ResourceID [highlight]/*here*/[/highlight]
INNER JOIN D10Task.dbo.Users Users ON ug.UserID = Users.UserID
WHERE resManager.ActionID = 1 [highlight]AND (resResource.CatID = resManager.CatID
OR (Inherit = 1 AND dbo.resCatIsDescendant(resManager.CatId,resResource.CatID) = 1))[/highlight]
It works normally the way it is written; however, when I move the highlighted code to join (highlighted place), I start getting the error about Dtabase id 112 being wrong cause it's not activated or is in transition.
Why is that?