Select IDs according to CSV file
Probably best to:


Import the entire CSV to a table using Import and Export Wizard.
Run the query to pull the data you want from the table.
Use the Import and Export Wizard to import to the other database.
Clean up the CSV import, probably by truncating or deleting the table.


Unless you want to use SSIS? Then you can design a package to do it easily without importing the whole file directly.