quick and dirty row to comma separated list

you no longer need Excel to comma deliminate your row based list from SQL

Tags: Technology, SQL
Posted by mjourdan on February 20, 2020

Fairly often i find myself needing to take the row based results in SQL Management Studio and turn them into a comma separated in clause. I would normally either re-write my SQL query to concatenate the results for me or turn to Excel. Many years ago I built an easy to use comma separate list tool so that I no longer needed to do either. You can simply copy and paste your row-based results into my tool. With a couple clicks of a button you will get your comma separated list. I was recently updating my tool to no longer use Flash to copy to the clipboard and thought I would share it with you. Have a look.

Let's say you have the following results from SQL Management Studio. In this example 7 rows of integers.

  • Now you simply copy the 7 rows to your clipboard.
  • Then open up my comma separate list tool.
  • Paste your clipboard into the input side of the screen.
  • Since the data is an integer, you do not need to add single-quotes around the data. So simply check the parenthesis options and include the in clause.
  • Click the comma separate button

Check out those results in the output window! I've even included a button so that you can copy the results right to the clipboard. Go ahead and give my comma separate list tool a try! Let me know what you think.