select * from user_tab_comments where table_name='UZK0BB';

解决方案 »

  1.   

    应该是从 user_col_comments表取吧
      

  2.   

    --检索表的注释
    select COMMENTS from user_tab_comments where table_name='TBMI_MEDSORT';
    --检索表的字段
    select COLUMN_NAME from user_tab_columns where table_name='TBMI_MEDSORT';
    --检索字段的注释
    select * from user_col_comments where table_name='TBHIS_DRUGUNIT';
      

  3.   

    偶写的根据表名来自动填充表结构信息的函数。'根据表名自动填充字段名列表[返回填充结果]
    '-------------------------------
    Private Function InitTabStru(ByVal strTName As String) As Integer
        
        On Error GoTo ErrLiner
        
        Dim intTemp     As Integer
        
        Dim strFieldsEn As String          '字段英文名列表
        Dim strFieldsCn As String          '字段中文名列表
        
        Dim strSql      As String
        Dim rsTemp      As ADODB.Recordset
        
        intTemp = 3                        '需要填充3项内容[表名注释,字段列表,字段注释]
        
        '填充表名的注释
        strSql = "select COMMENTS from user_tab_comments where table_name='" & strTName & "'"
        Set rsTemp = DbConn.Execute(strSql, 2)
        
        If rsTemp.EOF Then
            MsgBox "检索数据表结构发生错误!", vbInformation + vbOKOnly, "提示"
            Exit Function
        Else
            txtInput(1).Text = IIf(IsNull(rsTemp.Fields(0)), "未知", rsTemp.Fields(0))
            intTemp = intTemp - 1          '填充完一项
        End If
        
        '填充表的字段名,字段注释
        strSql = "select * from user_col_comments where table_name='" & strTName & "'"
        Set rsTemp = DbConn.Execute(strSql, 2)
        If rsTemp.EOF Then
            MsgBox "检索数据表结构发生错误!", vbInformation + vbOKOnly, "提示"
            Exit Function
        Else
            strFieldsEn = "|":    strFieldsCn = "|"
            
            Do Until rsTemp.EOF
                strFieldsEn = strFieldsEn & rsTemp.Fields("COLUMN_NAME") & "|"
                strFieldsCn = strFieldsCn & IIf(IsNull(rsTemp.Fields("COMMENTS")), "未知", rsTemp.Fields("COMMENTS")) & "|"
                
                rsTemp.MoveNext
            Loop
            
            txtInput(2).Text = strFieldsEn:    txtInput(3).Text = strFieldsCn        intTemp = intTemp - 2          '填充完两项
                
        End If
            
        InitTabStru = intTemp:    Exit Function
        
    ErrLiner:
        InitTabStru = Err.Number
        MsgBox "检索数据表结构发生错误!" & vbNewLine & Err.Description, vbInformation + vbOKOnly, "提示"
        
    End Function