2013-10-25 73 views

回答

1

檢查這個查詢:

SELECT 
    t.name AS TableName 
    , td.value AS TableDescription 
    , c.name AS ColumnName 
    , cd.value AS ColumnDescription 
FROM sys.tables t 
INNER JOIN sys.columns c ON t.object_id = c.object_id 
LEFT JOIN sys.extended_properties td 
    ON td.major_id = t.object_id 
    AND td.minor_id = 0 
    AND td.name = 'MS_Description' 
LEFT JOIN sys.extended_properties cd 
    ON cd.major_id = t.object_id 
    AND cd.minor_id = c.column_id 
    AND cd.name = 'MS_Description' 
+0

是的,它正在工作,非常感謝你.. –

2

你可以看到,使用INFORMATION_SCHEMA

爲了讓您能爲每個表列:

SELECT * FROM INFORMATION_SCHEMA.COLUMNS 

要獲取表信息,你可以這樣做:

SELECT * FROM INFORMATION_SCHEMA.TABLES 
0
desc table_name query is used to describe the table 
1
select * from INFORMATION_SCHEMA.TABLES 
select * from INFORMATION_SCHEMA.COLUMNS 
1
select * from user_col_comments; 

這將與登錄用戶評論顯示所有表的列。

select * from user_col_comments where table_name = '<table name>'; 

這將顯示指定表格的列,其中包含已登錄用戶的註釋。

+1

提供如果用戶評論被添加爲表,並且我懷疑天氣它在mysql中工作或沒有,oracle是。 –