--查询
DECLARE @str VARCHAR(1000)
SELECT @str = (SELECT b.name +','
FROM sys.all_columns AS b
WHERE a.object_id = b.object_id
FOR XML PATH('')
)
FROM sys.all_columns AS a
WHERE a.object_id =OBJECT_ID('sphwph')
GROUP BY a.object_id
--输出
SELECT CASE WHEN ISNULL(@str,'') ='' THEN '' ELSE LEFT(@str,LEN(LTRIM(RTRIM(@str)))-1) END
查某表中所有字段SQL
最新推荐文章于 2023-10-23 14:26:46 发布