/*
Assuming the format: ",4,5,6,7,8,9,10," for the list. This makes the
searching easier & eliminates wrong matches. Note that this will not use the
index if any on this column. Should be ok for non-indexed fields & if you
have other conditions covered by indexes.
*/
CREATE PROCEDURE #GetEmps
(
@CustomerIDs varchar(255)
)
AS
SELECT EmployeeID, LastName, FirstName, Title
FROM NorthWind..Employees
WHERE CHARINDEX(',' + Convert(varchar, EmployeeId) + ',', @CustomerIDs) > 0
GO
Exec #GetEmps ',1,2,3,'
This page was last updated on May 01, 2006 04:28 PM.