>>>>
ALTER PROCEDURE [dbo].[InvoicesSelectOutstanding]
>>>> WHERE inv_date <= @crt_date
>>>> AND inv_printed = 1
>>>> AND inv_cancelled is null
>>>>
>>>> ORDER BY cus_company
>>>>
>>>>This takes quite a while to run (47 seconds).
>>>>
>>>>If I uncomment the second to last line (AND cus_credit = 1) it runs in under 2 seconds.
>>>>The execution plan seems to tell me that everything is OK and I have indexes on all the joining and where fields.
>>>>Any suggestions on how to speed this up?
>>>
>>>What if you put AND cus_credit > -1 instead of commenting the line?
>>
>>That didn't make any difference, thanks. FYI: cus_credit is a boolean field
>>Is there any way to post the execution plan here for someone to look at?
>
>you might try something along
>and cus_credit*10 = 10
Hi Thomas,
can one multiply a boolean by an integer? Even if you could I'm not sure how that would help as then I will only get credit customers and won't get customers who are not credit customers.