Home Forums SQL Server 2005 T-SQL (SS2K5) Allow for Single or Multiple Value Select in Report Parameter RE: Allow for Single or Multiple Value Select in Report Parameter

  • I am unsure what the SELECT -1 does

    This alows you to display a simple, maybe default, empty selection in your combo, maybe to allow for "every option" or "ignore this filter", as I'll show you here:

    SELECT po.PurchaseOrderId,p.PrefixId

    FROM PurchaseOrders AS po

    INNER JOIN Prefix AS p ON po.Prefix = p.prefix

    WHERE p.PrefixId = @Prefix

    OR @Prefix = -1

    This OR @Prefix = -1 allows you to pass -1 and actually ignore the filter to return all rows.