Last active
February 13, 2024 11:44
-
-
Save barryparkin/9089296 to your computer and use it in GitHub Desktop.
(sqlite) Find table in database by field name
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 DISTINCT TABLE_NAME | |
FROM INFORMATION_SCHEMA.COLUMNS | |
WHERE COLUMN_NAME like '%{{fieldname}}%' | |
AND TABLE_SCHEMA = {{Database}}; |
Only fieldname has to be included
I just realised sqlite_master is a special table where sql is the last column with the CREATE statement text. Thanks !!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Only fieldname has to be included. Query result will show all the tables where there is a column name equal to fieldname.
