CREATE PROCEDURE [dbo].[BO_RemoveKnokTag]
	@KnokId int,
	@AnalysisTagId int,
    @Name VARCHAR(255) = NULL,
	@AnalysisTypeId int = NULL
AS
	IF @AnalysisTagId<>-1
		DELETE KnokAnalysisTags where KnokId = @KnokId and AnalysisTagId = @AnalysisTagId
	ELSE
		DELETE KnokCustomTags where KnokId = @KnokId and Name = @Name and AnalysisTagTypeId = @AnalysisTypeId
RETURN 0
