• Hi Lowell - I made a change which appears to have sorted out the comma, but I'd like to know whether removing the space padding might have som drawback which I haven't foreseen:

    I've commented out the space padding between column names in the indexes section, since your LEFT() was only removing one character, AFTER adding the space -

    SELECT QUOTENAME(COLS.[name]) + ',' --+ ' '

    Thanks,

    Kevin