text: ﻿CREATE PROCEDURE [dbo].[BugNet_Issue_GetIssuesByRelevancy] 
  	@ProjectId int,
  	@UserName NVarChar(255)
  AS
  DECLARE @UserId UniqueIdentifier
  SELECT @UserId = UserId FROM Users WHERE UserName = @UserName
  	
  SELECT 
  	*
  FROM
  	BugNet_IssuesView 
  WHERE
  	ProjectId = @ProjectId
  	AND Disabled = 0
  	AND (IssueCreatorUserId = @UserId OR IssueAssignedUserId = @UserId OR IssueOwnerUserId = @UserId)
  ORDER BY
  	IssueId Desc
  