ALTER TABLE [Like] ADD[ComputedNB_ItemId]  AS (case when [TargetType]=(1) then CONVERT([int],[TargetID])  end) PERSISTED
ALTER TABLE [Like] ADD[ComputedCommentId]  AS (case when [TargetType]=(2) then CONVERT([int],[TargetID])  end) PERSISTED

ALTER TABLE [Comment] ADD [ComputedCommentId]  AS (case when [TargetType]=(2) then CONVERT([int],[TargetID])  end) PERSISTED
ALTER TABLE [Comment] ADD [ComputedNB_ItemId]  AS (case when [TargetType]=(1) then CONVERT([int],[TargetID])  end) PERSISTED

CREATE NONCLUSTERED INDEX [ComputedNB_ItemId] ON [Like] ([ComputedNB_ItemId])
CREATE NONCLUSTERED INDEX [ComputedCommentId] ON [Like] ([ComputedCommentId])

CREATE NONCLUSTERED INDEX [ComputedCommentId] ON [Comment] ([ComputedCommentId])
CREATE NONCLUSTERED INDEX [ComputedNB_ItemId] ON [Comment] ([ComputedNB_ItemId])