Skip to content
| Marketplace
Sign in
Visual Studio Code>Formatters>SQL IN() FormatterNew to Visual Studio Code? Get it now.
SQL IN() Formatter

SQL IN() Formatter

keshu

| (0) | Free
Turn a list of values, one per line, into a SQL IN() clause or a TSQL VALUES() statement — with configurable trimming, empty-line skipping, and de-duplication.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

SQL IN() Formatter

Based on sql-in-statements by Edward Charles (MIT licensed). This fork adds configurable trimming/dedup/empty-line handling, a "Double Single Quotes" style for OPENQUERY, and the SQL VALUES() Statement command.

A VS Code extension with two commands for turning a pasted list of values into ready-to-use TSQL:

  • SQL IN() Statement — one value per line → a SQL IN() clause
  • SQL VALUES() Statement — one row per line (optionally multi-column) → a TSQL VALUES() statement

SQL IN() Statement

  1. Create a new editor window
  2. Paste a list separated by new lines
  3. Highlight the items in the list you want in the IN() statement
  4. Ctrl+Shift+P to bring up the VS Code Command Palette
  5. Type: SQL IN() Statement
  6. Choose a quote style:
    • With Quotes — ('abc','def')
    • Without Quotes — (1,2)
    • Double Single Quotes — (''abc'',''def''), for use inside an OPENQUERY string literal

SQL IN() Statement demo

SQL VALUES() Statement

Turns a selection into a TSQL VALUES() statement, one tuple per line. Each line can hold a single value, or multiple columns split by a delimiter (sqlIn.valuesDelimiter, tab by default — matching what you get pasting from Excel).

Select your list, Ctrl+Shift+P → SQL VALUES() Statement, then pick a quote style (same three choices as above).

Single column:

A
B
C

becomes

values(
('A'),
('B'),
('C')
)

Multiple columns (tab-separated by default):

A	1
B	2
C	3

becomes

values(
('A','1'),
('B','2'),
('C','3')
)

SQL VALUES() Statement demo

Settings

Configure these under SQL IN() Formatter in VS Code Settings (sqlIn.*):

Setting Default Description
sqlIn.trimValues true Trim leading/trailing whitespace from each value (or column) before quoting.
sqlIn.skipEmptyLines true Skip lines that are empty or contain only whitespace.
sqlIn.removeDuplicates false Remove duplicate values (or duplicate rows for VALUES), keeping the first occurrence.
sqlIn.valuesDelimiter \t (tab) Delimiter used to split each line into columns for SQL VALUES() Statement. Accepts \t, \n, \r, or any custom string such as , or \|.

Enjoy!


This project started as a fork of sql-in-statements by Edward Charles (MIT licensed) — thank you for the original idea and implementation.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft