Sql MSACCESS-如何使用查询生成表添加主键
我有一个使用以下SQL的查询生成表:Sql MSACCESS-如何使用查询生成表添加主键,sql,ms-access,select-into,Sql,Ms Access,Select Into,我有一个使用以下SQL的查询生成表: SELECT DISTINCT tblStore.Position, tblStore.Branch, tblStore.Location, tblStore.Operator INTO tblAllPositions FROM tblStore WHERE (((tblStore.Position) Is Not Null)) ORDER BY tblStore.Position, tblStore.Branch, tblStore.Location;
SELECT DISTINCT tblStore.Position, tblStore.Branch, tblStore.Location, tblStore.Operator INTO tblAllPositions
FROM tblStore
WHERE (((tblStore.Position) Is Not Null))
ORDER BY tblStore.Position, tblStore.Branch, tblStore.Location;
我想在新表tblAllPositions
中添加一个名为ID\u Positions
的字段,并将其设置为主键自动编号
我该怎么做呢?考虑一下:
ALTER TABLE tblAllPositions
ADD COLUMN ID_Positions COUNTER,
CONSTRAINT PrimaryKey PRIMARY KEY (ID_Positions)
在回顾ALTER TABLE并在上创建表教程后,我构建了该SQL,请考虑:
ALTER TABLE tblAllPositions
ADD COLUMN ID_Positions COUNTER,
CONSTRAINT PrimaryKey PRIMARY KEY (ID_Positions)
我在回顾了ALTERTABLE之后构建了SQL,并在