• OK -- you've can create stored procs and such... good to know.

    Next question -- do you have a "numbers" table or "tally" table on the server?

    If not, here's some SQL to build one. The solution I'm pondering may not need a permanent tally table, but it won't hurt to have one. (I think I obtained the code from Itzik Ben-Gan). The code below will insert 10,000 rows with one field populated with the numbers 1 to 10,000. This table can be leveraged to rapidly parse out the values from a multivalued delimited string.

    If you want to make sure about what this table will look like, comment out the "Insert" clause and just run the code in SSMS.

    My overall intention is to demonstrate, just using sql, how a multivalued delimited string can be parsed and then referenced in a way that mimicks the "StartsWith" functionality found in Crystal.

    SET NOCOUNT on

    CREATE TABLE dbo.Tally

    (

    N INT

    ,CONSTRAINT PK_Tally_N PRIMARY KEY CLUSTERED ( N )

    )

    DECLARE @n AS BIGINT;

    SET @n = 10000; /* SET ROW LIMIT HERE */

    WITH

    L0 AS(SELECT 1 AS c UNION ALL SELECT 1),

    L1 AS(SELECT 1 AS c FROM L0 AS A, L0 AS B),

    L2 AS(SELECT 1 AS c FROM L1 AS A, L1 AS B),

    L3 AS(SELECT 1 AS c FROM L2 AS A, L2 AS B),

    L4 AS(SELECT 1 AS c FROM L3 AS A, L3 AS B),

    L5 AS(SELECT 1 AS c FROM L4 AS A, L4 AS B),

    Nums AS(SELECT ROW_NUMBER() OVER(ORDER BY c) AS N FROM L5)

    INSERT DBO.[Tally] ([N])

    SELECT N FROM Nums WHERE n <= @n;

    SET NOCOUNT off