
-----------------------------------------------------------------------
CREATE PROCEDURE [dbo].[InsertCategoryLog]
@CategoryID INT,
@LogID INT
AS
BEGIN
SET NOCOUNT ON;

DECLARE @CatLogID INT
SELECT @CatLogID FROM CategoryLog WHERE CategoryID=@CategoryID and LogID = @LogID
IF @CatLogID IS NULL
BEGIN
INSERT INTO CategoryLog (CategoryID, LogID) VALUES(@CategoryID, @LogID)
RETURN @@IDENTITY
END
ELSE RETURN @CatLogID
END

GO
GRANT EXECUTE
    ON OBJECT::[dbo].[InsertCategoryLog] TO [Healthchoice_Website]
    AS [dbo];

