SELECT table_name, LEFT(column_names , LEN(column_names )-1) AS column_names
FROM information_schema.columns AS extern
CROSS APPLY
(
SELECT column_name + ‘,‘
FROM information_schema.columns AS intern
WHERE extern.table_name = intern.table_name
FOR XML PATH(‘‘)
) pre_trimmed (column_names)
--where table_name =‘表名‘
GROUP BY table_name, column_names;
时间: 2024-10-09 11:17:05