How can i learn Table Name in database an column name?

Posted by Phsika on Stack Overflow See other posts from Stack Overflow or by Phsika
Published on 2010-06-17T06:43:25Z Indexed on 2010/06/17 6:53 UTC
Read the original article Hit count: 227

Filed under:
|
|
|

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:(

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET