sqlserver:
alter table 表名 drop column 列名
oracle:
alter table 表名 drop column 列名
mysql:
alter table 表名 drop column 列名
总结:在主流数据库下,删除列的语法是一致的,并无差别。
估计这个库中的某个表上有instead of delete的触发器吧,你可以在该库的"可编程"下找一下是否有触发器,如果确定不要了,把触发器删除,这样它监视的表就可成功删除,库也就可以删掉了~~或者直接强制"分离数据库"(右键库去选),分离掉之后,库的文件还在,可以再在 *** 作系统中删除文件
Sub 更新姓名库()Dim cnn As ADODB.Connection
Dim MyConn
Dim rst As ADODB.Recordset
Dim I As Long, j As Long
Dim Rw As Long
Dim rng, tt, N%, Ta()
Call 数据库路径
'激活所需要的工作表,获取已使用的行数
rng = Sheets("考号系统").UsedRange
tt = Array("准考证号", "统考号", "姓名", "班", "考场1", "座位1", "拼音首字")
N = 0
ReDim Ta(0 To 6)
For N = 0 To 6
Call 查找(tt(N))
'If rng(1, I) = tt(N) Then
Ta(N) = dxcol
'End If
Next
'创建对数据库的连接
Set cnn = New ADODB.Connection
MyConn = pathi
With cnn
.Provider = "Microsoft.Jet.OLEDB.4.0"
.Open MyConn
End With
'创建记录集
Set rst = New ADODB.Recordset
rst.CursorLocation = adUseServer
rst.Open "delete * from baseinfo", cnn, 1, 3
rst.Open Source:="baseinfo", ActiveConnection:=cnn, _
CursorType:=adOpenDynamic, LockType:=adLockOptimistic, _
Options:=adCmdTable
Do While Not rst.BOF And Not rst.EOF
rst.Delete
rst.Update
Loop
'将Excel中所有的记录载入Access.
For I = 2 To UBound(rng)
rst.AddNew
'For j = 1 To 7
If Left(rng(2, 1), 4) = 1323 Then
rst("考号") = rng(I, Ta(1))
Else
rst("考号") = rng(I, Ta(0))
End If
rst("班级代码") = rng(I, Ta(3))
rst("班级") = rng(I, Ta(3))
rst("姓名") = rng(I, Ta(2))
rst("试室号") = rng(I, Ta(4))
rst("座位号") = rng(I, Ta(5))
rst("拼音首字") = rng(I, Ta(6))
'Next j
rst.Update
Next I
' 关闭连接并清理内存
rst.Close
cnn.Close
Set rst = Nothing
Set cnn = Nothing
Erase rng
MsgBox "姓名库更新完毕", vbOKOnly, " *** 作成功"
End Sub
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)