If you’ve ever used SQL Server’s Database Mail to email the results of a query, you might have noticed that the results are separated by a space by default.
This is fine if you want a space-separated result set, but what if you want it to be comma-separated?
Fortunately you can use the @query_result_separator
argument to do just that. You can use this argument to specify any separator (as long as it’s a char(1)).