开发者

How to get names of the table attributes?

I am working Sql Server 2005 My table name is Customer, the attributes are

Orderid Customerid Customeraddress

Wherein Customerid is the primary key and Orderid is the foreign key.

I want to know the primary key name, foreign key name and the table name where the foreign key exists as a primary key

Is there any query to retrieve those names using a table name? Kindly please provide me the queries...T开发者_JAVA技巧hanks in advance


--list all columns in BLAH table select c.name from sys.columns c, sys.tables t where c.object_id=t.object_id and t.name='BLAH'

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜