Returning only the column names from a SELECT statement
This is just a lazy thought. I have a table with about 9 columns names. Is there any way I can use SQL statement to return only the Column names? The normal way is to write out my column names from
SELECT * FROM tableName;
statement but was wondering if I can get the column names with SQL statement.
Any Ideas would be appreciated.
Thanks You!
SELECT COLUMN_NAME,*
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'tableName' AND TABLE_SCHEMA='dbo'
应该这样做
尝试按照SQL语句获取列名称。
SELECT column_name FROM information_schema.columns WHERE TABLE_NAME='tableName'
SET FMTONLY ON
SELECT * FROM tablename
链接地址: http://www.djcxy.com/p/93844.html
上一篇: 使用数据集进行Microsoft报告
下一篇: 仅从SELECT语句返回列名称