Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/73.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql MSACCESS-如何使用查询生成表添加主键_Sql_Ms Access_Select Into - Fatal编程技术网

Sql MSACCESS-如何使用查询生成表添加主键

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;

我有一个使用以下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;
我想在新表
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,并在