Thursday, July 11, 2019

DB Tip of the day - (mostly) Standard way to get table schema

Handy to know the Standard SQL way to get a table schema. Different databases have their own commands, but this is pretty but not completely universal. SQL Server, Postgres, MySQL support this. Sadly Oracle does not.

select column_name, data_type, character_maximum_length from INFORMATION_SCHEMA.COLUMNS where table_name = 'tableName';


No comments:

Post a Comment