什么是 Select 语句来返回表中的列名 [英] What is the Select statement to return the column names in a table

查看:48
本文介绍了什么是 Select 语句来返回表中的列名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何选择语句返回表中的列列表?

Is there any select statement to return the list of columns in the table?

推荐答案

INFORMATION_SCHEMA.COLUMNS 视图将提供特定表名的列名.

The INFORMATION_SCHEMA.COLUMNS view will provide the column names for a particular table name.

SELECT Column_Name + ', '
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'Table_Name'

还有其他几个视图以及上面的视图,您可能会发现它们很有用.这些 INFORMATION_SCHEMA 视图提供有关数据库架构的信息.

There are several other views as well as the one above which you may find useful. These INFORMATION_SCHEMA views provide information on the schema of your database.

Select top 10 * from Information_Schema.tables 
Select top 10 * from Information_Schema.views 
Select top 10 * from Information_Schema.routines 
Select top 10 * from Information_Schema.parameters

这篇关于什么是 Select 语句来返回表中的列名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆