>
>put this into SSMS
>
>EXEC [dbo].[InvoicesSelectOutstanding] @crt_date =GETDATE()
>
>
>select it and into "Query" menu select
>"Analyze Query with Optimization ..." ( this may not be exact syntax )
>
>This suggest statistics and index to optimize the sql script.
>If this doesn't optimize the query,
>you need to rethink the declarative code.
>Remember that SQL engive is complex and not perfect,
>on some cases the plan is wrong.
Thanks Fabio and everyone else,
I had actually already done that and it helped somewhat, but on the customer site it's still not running fast enough. I need to do some more digging, but at the moment I have some higher priorities and will hopefully make some time for this next week.