How would I create a temp table in SQL Server when I have a big list of ID's

Viewed 19382

I have a list of raw IDs that I am supposed to put into a temp table. I am unsure about how this works in SQL Server:

I know the general format:

select PID into #myPIDs
from ... ?

I already have a list of about 30 PIDs which I am to use. They look like so:

'U388279963',
'U388631403',
'U389925814'

How do I go about doing this? Thanks!

3 Answers

If you original table (from witch comes IDs) is accessible and always have a row with each ID :

SELECT originalTable.ID
INTO #myPIDs
FROM originalTable
WHERE originalTable.ID IN ('U388279963', 'U388631403', 'U389925814')
Related