WebAug 13, 2024 · Using information_schema.columns: SELECT column_name, data_type FROM information_schema.columns WHERE table_name = 'foo' ORDER BY ordinal_position; The information is standardized, but incomplete: column_name data_type ------------+---------------------------- a numeric b timestamp without time zone WebMay 23, 2016 · SQL Server: SELECT Table_Name, Column_Name FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_CATALOG = 'YOUR_DATABASE' AND COLUMN_NAME LIKE '%YOUR_COLUMN%' Oracle: SELECT owner, table_name, …
Find Tables, Columns or Stored Procedures used in a …
WebFeb 26, 2016 · I. Find Table By Table Name Querying sys.tables The most common and simple method to find and list down the tables in a database based on the name of the … WebTo Show the TABLES and COLUMNS in the database or find TABLES and COLUMNS. This first query will return all of the tables in the database you are querying. SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES The second query will return a list of all the columns and tables in the database you are querying. get off to a rough start
Find sql records containing similar strings - Stack Overflow
WebSep 9, 2024 · Only one thing which was common was that each column name contained the word GUID in it. Here is the script which you can run for your database and Find All Tables Containing Specific Column Name. 1 2 3 4 SELECT Table_Name, Column_Name FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_CATALOG = 'YOUR_DATABASE' AND … WebAug 13, 2013 · Sorted by: 31. In SQL Server, you can query sys.columns. Something like: SELECT t.name FROM sys.columns c inner join sys.tables t on c.object_id = t.object_id … WebYou can use the INFORMATION_SCHEMA database and the COLUMNS table in particular Example of use: SELECT table_name, column_name, data_type, ordinal_position FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = 'myDatabase' --- the database you want to search AND column_name = 'name' ; --- or: column_name LIKE '%name%' … get off to a shaky start