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

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

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