I am using the example from the Microsoft Official Course 2030A.
I want the option for a user to select valeu from a drop down to return all records or to choose individual ones from the multi-value check box.
My query is taking forever and as you see I just want the top ten
Select TOP 10 * from PRH_EOB
WHERE (MemberId = @.MemberId OR @.MemberId = 'ALL')
and (disenr_st = @.Disenroll or @.Disenroll = 'ALL')
and (LOB in (Select * from SplitList(',',@.LOB) as ListItem) or @.LOB = 'ALL')
and (Groupid in (Select * from SplitList(',',@.GroupList) as ListItem) or @.Grouplist = 'ALL')
and paydate between @.From and @.TO
order by Slastname, sFirstname, claimid, linenum
Thanks,
Phil
Come to find out, I have to put an index hint in the query to get it to work.
ex
Select * from PRH_EOB (INDEX = IX_PayDate)
WHERE (MemberId = @.MemberId OR @.MemberId = 'ALL')
and (disenr_st = @.Disenroll or @.Disenroll = 'ALL')
and (LOB in (Select * from SplitList(',',@.LOB) as ListItem) or @.LOB = 'ALL')
and (Groupid in (Select * from SplitList(',',@.GroupList) as ListItem) or @.Grouplist = 'ALL')
and paydate between @.From and @.TO
order by Slastname, sFirstname, claimid, linenum
No comments:
Post a Comment