【问题标题】:How can I SELECT that lists all the field names and their types for a given Db Table? [duplicate]如何选择列出给定 Db 表的所有字段名称及其类型? [复制]
【发布时间】:2012-01-04 15:03:26
【问题描述】:

可能重复:
SQL Server: How do you return the column names from a table?

假设我有数据库表:LunchMenuItems

对于 MS-SQL Server,我如何编写一个 TSQL 查询:

列出LunchMenuItems表中的所有列名及其类型?

【问题讨论】:

标签: sql sql-server tsql


【解决方案1】:

说明

此信息可以在information_schema.columns找到。

样本

select column_name, DATA_TYPE from information_schema.columns
where table_name = 'LunchMenuItems'

更多信息

【讨论】:

    猜你喜欢
    • 2022-01-09
    • 2016-09-02
    • 2011-09-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-01-31
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多