SQL IN List Builder
Paste a column of values from Excel, a report, or an email and get a correctly quoted SQL Server IN (...) list. Removes duplicates and blanks, escapes apostrophes, and detects numbers. Your values never leave your browser.
How to use it
Copy a column of cells from Excel (or any list) and paste it into the left box, then click Build IN list. Paste the result into your WHERE clause. Set a column name to get a complete condition such as c.CustomerCode IN (...). Set values per line to 0 to keep everything on one line.
If every value is a plain number, the list is left unquoted. Otherwise each value is wrapped in single quotes, with any apostrophes doubled (O'Neill becomes 'O''Neill').
FAQ
How many values can an IN list have?
There's no fixed limit, but lists with thousands of values compile slowly and very large ones can fail with an out-of-resources error. Past a couple of thousand values, load them into a temp table or table variable and join to it instead. The tool warns you when a list gets that long.
Why are values with leading zeros quoted?
Values like 00042 are usually codes, not numbers. Unquoted, SQL Server would read 00042 as 42. Quoting keeps them exact; if the column is numeric, SQL Server still converts them correctly.
Does NOT IN work with NULLs?
Be careful: if the column you compare against can be NULL, NOT IN leaves those rows out. And if the list itself contained a NULL, NOT IN would return no rows at all, which is why this tool never adds one.
Should I use N'...' strings?
Use them when the column is nvarchar or values contain non-English characters. Matching the column's type also helps SQL Server use indexes.
Is my data uploaded?
No. Everything runs in your browser, and the site's security policy blocks the page from sending data anywhere.
Practice T-SQL on a realistic database
The Bramble Cycles SQL Workbook has 120 hands-on SQL Server exercises on a three-store bike shop database, from your first SELECT to window functions and index tuning. Every exercise has a check line and an answer key.