|
今天利用JET SQL的“CREATE TABLE”来创建表的过程中遇到一点问题
就是无法实现创建普通索引
strSQL = "CREATE TABLE Customers2 (CustId INTEGER, CLstNm TEXT (50), CONSTRAINT CustId NULL (CustId))"
我的目的就是一句SQL“CREATE TABLE”实现下面的功能
strSQL = "CREATE TABLE Customers2 (CustId INTEGER, CLstNm TEXT (50))"
strSQL = "CREATE INDEX CustId ON Customers2 (CustId)"
以下主键和唯一键可以通过“CREATE TABLE”创建
Dim cnn As ADODB.Connection
Dim strSQL As String
Set cnn = CurrentProject.Connection
strSQL = "CREATE TABLE Customers2 (CustId INTEGER, CLstNm TEXT (50), CONSTRAINT CustId UNIQUE (CustId))"
strSQL = "CREATE TABLE Customers2 (CustId INTEGER, CLstNm TEXT (50), CONSTRAINT CustId PRIMARY KEY (CustId))"
cnn.Execute strSQL, , adExecuteNoRecords
cnn.Close
Set cnn = Nothing |
|