Now i see what ur saying. But we are eventually bursting this report and we need the record selection and we hav to use it for the purpose of bursting, so that while Bursting, it looks into the selection formula and bursts to that specific payer folder in the CMC. Anywayz i will provide the where condition of the SP. Thanks for ur thoughts and ideas.
Select @Product as productID into #ppp
If @Product = -1
Begin
Delete from #ppp
Insert into #ppp Select productID from tblProducts
End
Else If @Product = 1
Begin
Insert into #ppp (productID) Values (8)
End
----------
select
*
into d#
From
tblclaims c with (nolock)
Inner Join
tblclaimproducts cp with (nolock) on c.claimid=cp.claimid
Inner Join
tblactions a with (nolock) on a.claimid=c.claimid and a.productid=cp.productid
Inner Join
tblstaff s with (nolock) on s.staffid=cp.auditorid
Inner Join
tblproviders pv with (nolock) on pv.providerid=c.providerid
Inner Join
tblclients cl with (nolock) on cl.clientid=c.clientid
Inner Join
tblproducts p with (nolock) on p.productid=cp.productid
Where
and cp.claimproductinvoicenum is null
and (c.clientid = @Payer or @Payer = -1)
and a.productid IN (Select productid from #ppp)
AND (LTRIM(RTRIM(C.ClaimGroupName)) = @ReportGroup OR @ReportGroup = '%')
Edited by Nav522 - 05 Feb 2010 at 12:15pm