list all columns of a table sql code example
Example 1: sql server find columns list in tables
SELECT *
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = N'DIM_VENDING_MATERIALS'
Example 2: sql all columns
-- MySQL
SELECT *
FROM INFORMATION_SCHEMA.COLUMNS;
-- SQL Server (possible solution)
SELECT *
FROM SYS.COLUMNS;
-- Oracle
SELECT *
FROM ALL_TAB_COLS; -- (If you only want user-defined columns)
-- ALL_TAB_COLS : only user-defined columns
-- ALL_TAB_COLUMNS : both user-defined AND system columns