sqlfunctionquotename

SQL QUOTENAME adding single quotes and a comma


I have a basic table which outputs.

field1
  a
  b
  c

Then i want to add single quotes and a comma so currently i have a simple QUOTENAME.

QUOTENAME(field1,'''')

Which outputs the following results.

field1
  'a'
  'b'
  'c'

But i cant figure out how to get the QUOTENAME to output results like this.

field1
  'a',
  'b',
  'c',

Solution

  • Try:

    QUOTENAME(field1,'''')+','