Created
April 4, 2019 21:40
-
-
Save lewdev/40d4d0f788e594e4ad1e06f3815555e3 to your computer and use it in GitHub Desktop.
An SQLite query that looks for a column name and also provides some additional column information too.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
m.name AS table_name, | |
p.cid AS col_id, | |
p.name AS col_name, | |
p.type AS col_type, | |
p.pk AS col_is_pk, | |
p.dflt_value AS col_default_val, | |
p.[notnull] AS col_is_not_null | |
FROM sqlite_master m | |
LEFT OUTER JOIN pragma_table_info((m.name)) p | |
ON m.name <> p.name | |
WHERE m.type = 'table' | |
AND p.name LIKE '%QUERY COLUMN NAME HERE%' | |
ORDER BY table_name, col_id |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment