This article presents two ways to select rows based on a list of IDs (or other values) in SQL Server. This can be useful in scenarios where you have a comma-separated list of IDs, and you want to query your database for rows that match those IDs.
Say you have the following list of IDs:
1,4,6,8
And so you now want to query a table for records that have any of those values (i.e. either 1, 4, 6 or 8) in its ID column.
Here are two ways to go about that.