表的字段名转为逗号相隔的字符串

select 
replace(
	replace(
		stuff(
			(
				Select ',',Name
				From SysColumns 
				Where id=Object_Id('表名') and 
				name not in ('Id')
				for xml path('')
			),
			1,
			1,
			''),
		'<Name>',
		''),
	'</Name>',
	''
)

编程技巧