mysql 字段必填 属性_如何判断数据库中的字段是否具有必填属性(50分)
你試試用SQLDMO吧
提供如下供參考
Option Explicit
Dim dd As SQLDMO.Database
Dim ss As New SQLDMO.SQLServer
Dim tt As SQLDMO.Table
Dim S As String
Sub AnalyzeDB()
Dim i As Long, j As Long
On Error Resume Next
'在下面修改機器名稱
'/
ss.Connect "hp-server", "sc", "320322"//sc 為登錄sql server的用戶名320322為口令
'/
For Each dd In ss.Databases
'在下面修改數據庫名稱
' //
If LCase(dd.Name) = "databasename" Then
'//
Selection.TypeText dd.Name & vbCrLf & vbCrLf
With ThisDocument.Tables.Add(Selection.Range, dd.Tables.Count + 1, 2)
.Cell(1, 1).Select
Selection.TypeText "表名"
.Cell(1, 2).Select
Selection.TypeText "說明"
For i = 1 To dd.Tables.Count
DoEvents
.Cell(i + 1, 1).Select
Selection.TypeText dd.Tables(i).Name
.Cell(i + 1, 2).Select
Selection.TypeText dd.Tables(i).Properties("Description").Value
Next i
End With
Selection.GoToNext wdGoToLine
Selection.TypeText vbCrLf
For i = 1 To dd.Tables.Count
DoEvents
'///
'If (LCase(dd.Tables(i).Name) = "sfdwsfxmk") Or (LCase(dd.Tables(i).Name) = "sfxmk") Or (LCase(dd.Tables(i).Name) = "sfdwxxk") Then
'//
Selection.TypeText dd.Tables(i).Name
Selection.TypeText dd.Tables(i).Properties("Description").Value
Selection.TypeText vbCrLf
With ThisDocument.Tables.Add(Selection.Range, dd.Tables(i).Columns.Count + 1, 7)
.Columns(1).Width = 104.4
.Columns(2).Width = 117
.Columns(3).Width = 72
.Columns(4).Width = 36
.Columns(5).Width = 27
.Columns(6).Width = 27
.Columns(7).Width = 42.55
.Cell(1, 1).Select: Selection.TypeText "字段"
.Cell(1, 2).Select: Selection.TypeText "說明"
.Cell(1, 3).Select: Selection.TypeText "類型"
.Cell(1, 4).Select: Selection.TypeText "長度"
.Cell(1, 5).Select: Selection.TypeText "NN"
.Cell(1, 6).Select: Selection.TypeText "ZL"
.Cell(1, 7).Select: Selection.TypeText "默認值"
For j = 1 To dd.Tables(i).Columns.Count
DoEvents
.Cell(j + 1, 1).Select: Selection.TypeText dd.Tables(i).Columns(j).Name
.Cell(j + 1, 2).Select: Selection.TypeText dd.Tables(i).Columns(j).Properties("Description").Value
.Cell(j + 1, 3).Select: Selection.TypeText dd.Tables(i).Columns(j).Datatype
.Cell(j + 1, 4).Select: Selection.TypeText dd.Tables(i).Columns(j).Length
.Cell(j + 1, 5).Select: Selection.TypeText IIf(dd.Tables(i).Columns(j).AllowNulls, "Y", "N")
.Cell(j + 1, 7).Select: Selection.TypeText dd.Tables(i).Columns(j).Default
Next j
End With
Selection.GoToNext wdGoToLine
Selection.TypeText vbCrLf
'///
'End If
'///
Next i
Set dd = Nothing
End If
Next
End
End Sub
這是用vba寫的你可以參考下改成delphi的就可以了
總結
以上是生活随笔為你收集整理的mysql 字段必填 属性_如何判断数据库中的字段是否具有必填属性(50分)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: java 启动参数_网红框架Spring
- 下一篇: 蛋糕店加盟多少钱啊?