• What you need to know is that SSRS formats multiple selections in a parameter as a comma separated list, like this:

    "01,-99"

    So, when your query runs you are effectively saying

    WHERE ('01,-99' in ('01','-99') and ...)

    which is never going to evaluate as true.

    I imagine that when you get this working, performance will be terrible because of all the "OR" clauses, but here is a quick way to get it working, and then you can work on performance.

    Tally OH! An Improved SQL 8K “CSV Splitter” Function

    By Jeff Moden, 2012/12/28 (first published: 2011/05/02)

    Read the article above and you will find a lovely function for splitting small strings "DelimitedSplit8K".

    You can use that here to split the parameter string back out into individual items and then your query will work like this:

    SELECT ...

    FROM ...

    cross apply ssc.dbo.DelimitedSplit8KB(@Unknowns,',')

    WHERE

    AND ([Item] IN('01','-99') AND (r.race='Unknown'))

    OR ([Item] IN('02','-99') AND (r.Ethnicity='Unknown'))

    OR ([Item] IN('03','-99') AND (r.Gender='Unknown'))

    OR ([Item] IN('04','-99') AND (r.Religion='Unknown'))

    OR ([Item] IN('05','-99') AND (r.Language='Unknown'))

    OR ([Item] IN('06','-99') AND (r.SFFamilySize='0'))

    OR ([Item] IN('07','-99') AND (r.DateOfBirth IS NULL))

    OR ([Item] IN('08','-99') AND (r.AddressLine1 IS NULL))

    OR ([Item] IN('09','-99') AND (r.HomelessStatus IN ('Unknown','Missing'))

    OR ([Item] IN('10','-99') AND (r.HomelessBox='NOT CHECKED'))

    OR ([Item] IN('11','-99') AND (r.PostalCode IS NULL))

    OR ([Item] IN('12','-99') AND (r.PreferredProvider IS NULL))

    OR ([Item] IN('13','-99') AND (r.VeteranStatus ='Missing'))

    OR ([Item] IN('14','-99') AND (r.MaritalStatus ='Missing'))

    OR ([Item] IN('15','-99') AND (r.EducationStatus ='Missing'))

    MM



    select geometry::STGeomFromWKB(0x0106000000020000000103000000010000000B0000001000000000000840000000000000003DD8CCCCCCCCCC0840000000000000003DD8CCCCCCCCCC08408014AE47E17AFC3F040000000000104000CDCCCCCCCCEC3F9C999999999913408014AE47E17AFC3F9C99999999991340000000000000003D0000000000001440000000000000003D000000000000144000000000000000400400000000001040000000000000F03F100000000000084000000000000000401000000000000840000000000000003D0103000000010000000B000000000000000000143D000000000000003D009E99999999B93F000000000000003D009E99999999B93F8014AE47E17AFC3F400000000000F03F00CDCCCCCCCCEC3FA06666666666FE3F8014AE47E17AFC3FA06666666666FE3F000000000000003D1800000000000040000000000000003D18000000000000400000000000000040400000000000F03F000000000000F03F000000000000143D0000000000000040000000000000143D000000000000003D, 0);

  • Forum Etiquette: How to post Reporting Services problems
  • [/url]
  • Forum Etiquette: How to post data/code on a forum to get the best help - by Jeff Moden
  • [/url]
  • How to Post Performance Problems - by Gail Shaw
  • [/url]