One with a list of users.
I have found the issue, it seems to be because of having several IN Clause's.
There are 5 parameter that use IN clauses. When I removed one of them it works. I think the limit is 2100 in the list
Not sure how to get round this.
I have ran the query in Management studio and it works fine.