> The following is the problem query.
>
[quoted text clipped - 15 lines]
> The problem is that when it is Null, @M.TargetValue ends up being ''. How
> can I avoid this?
And, of course, the query had a typo. The query should be
INSERT INTO @M (ParameterID, EntityID, TargetValue)
SELECT M.ParameterID, M.EntityID, TM.MetricValue
FROM tblMetric M
INNER JOIN @ins i ON M.ParameterID = i.ParameterID AND M.EntityID =
i.EntityID
INNER JOIN (SELECT ParameterID, EntityID, MetricDate AS TargetDate,
MetricValue AS TargetValue
FROM tblMetric
WHERE MetricTypeID = @TargTypeID) TM ON i.EntityID = TM.EntityID AND
i.ParameterID = TM.ParameterID AND i.TargetDate = TM.TargetDate
WHERE MetricTypeID IN (@BaseTypeID, @MonTypeID)

Signature
Pat
--
Pat
> I should clarify -- The problem is that when TM.TargetValue is Null,
> @M.TargetValue ends up being ''. How
[quoted text clipped - 19 lines]
> > The problem is that when it is Null, @M.TargetValue ends up being ''. How
> > can I avoid this?