List all Fields in all Tables on SEDE

2

Please login or register to vote for this query.

(click on this box to dismiss)

Lists all columns and their datatypes for all tables in Data Explorer

Stack Overflow

Q&A for professional and enthusiast programmers

SELECT
       TABLE_NAME,
       ORDINAL_POSITION,
       COLUMN_NAME,

       DATA_TYPE ,
       CHARACTER_MAXIMUM_LENGTH ,
       NUMERIC_PRECISION ,
       NUMERIC_PRECISION_RADIX ,
       NUMERIC_SCALE 
       
FROM   INFORMATION_SCHEMA.COLUMNS;

--TABLE_SCHEMA = 'dbo'
--COLUMN_DEFAULT = Null
--DATETIME_PRECISION = 3 (when DATETIME)

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results