Multiple values in a single parameter of a scalar function

Viewed 4616

Is there a way to input multiple values in a single parameter of a scalar-valued function in SQL Server 2008 R2 and have it filter data by that parameter using both values?

For example I would like to do the following

    SET @Salesperson='BILL' OR 'MOSES'

    SELECT Sum(SalesDollars)
    FROM Invoices
    WHERE Invoices.Salesperson = @Salesperson

I attempted to use the following as the WHERE clause, but this didnt work either.

    SET @Salesperson='BILL','MOSES'

    SELECT Sum(SalesDollars)
    FROM Invoices
    WHERE Invoices.Salesperson IN (@Salesperson)

Would it be easier if i were dealing with integers as opposed to varchar values?

Any help would be absolutely appreciated!

3 Answers
Related