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

Your format will work for creating a new temp table for one insert. If you need to copy and paste your IDs then the following will work.

CREATE TABLE #myPIDs
(
     PID VARCHAR(30)
);

INSERT INTO #myPIDs
VALUES
(....),
(....);

Copy and paste your PIDs and use find and replace with regular expressions to replace each line with the regular expression option checked. Remove the last ',' and you're good.

Find - ^{U:z+}$

Replace - ('\1'),\n

Alternatively you can have sql server read your ids from a file on the system. If you elaborate on your needs I can give you a better answer.


insert into #myPIDs (ID) 
select 'U388279963'
union 
select 'U388631403'
union 
select 'U389925814'