How do I return the SQL data types from my query?

前端 未结 13 1670
耶瑟儿~
耶瑟儿~ 2021-01-29 23:58

I\'ve a SQL query that queries an enormous (as in, hundreds of views/tables with hard-to-read names like CMM-CPP-FAP-ADD) database that I don\'t need nor want to understand. Th

13条回答
  •  执笔经年
    2021-01-30 00:23

    SELECT COLUMN_NAME,
           DATA_TYPE,
           CHARACTER_MAXIMUM_LENGTH
    FROM information_schema.columns
    WHERE TABLE_NAME = 'YOUR_TABLE_NAME'
    

    You can use columns aliases for better looking output.

提交回复
热议问题