在MS SQL Server中,想获取表的所有列名,可以使用下面SQL语句:
SELECT [COLUMN_NAME] FROM [INFORMATION_SCHEMA].[Columns] WHERE [TABLE_NAME] = '表名'
SELECT [NAME] FROM [tempdb].[sys].[columns] WHERE OBJECT_ID = OBJECT_ID('tempdb..#表名')
本文共 260 字,大约阅读时间需要 1 分钟。
在MS SQL Server中,想获取表的所有列名,可以使用下面SQL语句:
SELECT [COLUMN_NAME] FROM [INFORMATION_SCHEMA].[Columns] WHERE [TABLE_NAME] = '表名'
SELECT [NAME] FROM [tempdb].[sys].[columns] WHERE OBJECT_ID = OBJECT_ID('tempdb..#表名')
转载地址:http://bpbfa.baihongyu.com/