All Tables, Columns, Data_Types(incl. Length or Precision) in SEDE

0

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

EOS.IO

Q&A for users and developers of distributed applications built on top of the blockchain operating system, EOS.IO

SELECT
  table_name,
  ordinal_position,
  column_name,
  TABLE_SCHEMA,
  CASE
    WHEN data_type like '%varchar%'
      THEN data_type+'('+cast(character_maximum_length as varchar)+')'
    WHEN data_type like '%int%'
      THEN data_type+'('+cast(numeric_precision as varchar)+')'
    ELSE
      data_type
  END AS [type]
FROM information_schema.columns
--where table_name like '%Types%' --ⓘuncomment this line to limit to reference tables
ORDER BY table_name, ordinal_position

---------------------------------------------------------------------
--SEDE Fields not included since all records always have these value:
--  TABLE_SCHEMA            = 'dbo'
--  COLUMN_DEFAULT          = Null
--  DATETIME_PRECISION      = 3 (when DATETIME)
--  NUMERIC_PRECISION_RADIX = (when TINYINT, SMALLINT, INT)
--  NUMERIC_SCALE           = Null
---------------------------------------------------------------------

-- ⓘ=tables ending with '%Types' are static reference tables

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results