• Faye Fouladi (12/24/2012)


    How do I correct the following statement:

    Declare @Component smallint = -1

    Select srcComment.Comment As Comment, t.NameFull As CommentType, parenttypeId As Component,

    (select Quarter From dimPeriod where periodId = srcComment.ParentId) As Quarter,

    (select Year From dimPeriod where periodId = srcComment.ParentId) As periodYear

    From srcComment

    inner JOIN dimPeriod p

    ON srcComment.ParentId = p.periodId

    Left Outer Join refType t

    ON t.TypeId = srcComment.ParentTypeId

    where case @Component

    when -1 then

    parenttypeId IN (601, 605, 606)

    else parenttypeId = @Component End

    Hard to say, you tell us the error message you received.