How can i learn Table Name in database an column name?
- by Phsika
How can i learn table Name in database an how can i learn any Table's Column name?
SELECT Col.COLUMN_NAME, Col.DATA_TYPE
FROM INFORMATION_SCHEMA.COLUMNS AS Col
LEFT OUTER JOIN INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE AS Usg ON Col.TABLE_NAME = Usg.TABLE_NAME AND Col.COLUMN_NAME = Usg.COLUMN_NAME
LEFT OUTER JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS AS Con ON Usg.CONSTRAINT_NAME = Con.CONSTRAINT_NAME
WHERE Col.TABLE_NAME = 'Addresses_Temp' AND Con.Constraint_TYPE = 'PRIMARY KEY'
But it returns to me empty data:(