I've used this technique in where clauses before - I'm not sure if it'll work in a having clause or not, but you might try it:
HAVING
(@CompanyID IS NULL OR (SubUtilCurrent.ClientID = @CompanyID)) AND
(@VendorID IS NULL OR (SubUtilCurrent.VendorID = @VendorID)) AND
(@SiteID IS NULL...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.