在 AZURE SQL 中创建空间索引时出错
Error creating spatial index in AZURE SQL
我正在尝试为 Azure SQL 上的 geography
数据类型创建空间索引。这是代码:
CREATE SPATIAL INDEX IX_Shop_LatLong ON Shop(LatLong)
USING GEOGRAPHY_GRID WITH (GRIDS = (LEVEL_1 = HIGH, LEVEL_2 = MEDIUM, LEVEL_3 = MEDIUM, LEVEL_4 = MEDIUM), CELLS_PER_OBJECT = 16, DROP_EXISTING = ON)
我得到的错误是:
Could not find the spatial index 'IX_Shop_LatLong' on table 'Shop'. Either no spatial index with this name exists, or a non-spatial index might be using the same name. Fix the index name, avoiding duplicates. If a relational index has the same name, drop the regular relational index.
我正在尝试提供其他名称,但我遇到了同样的错误。
该错误表明空间索引定义不存在,无法修改,因为您使用的是 DROP_EXISTING = ON 选项。使用此选项,需要存在匹配索引(正确类型),否则您将收到此错误。如果您在 table 上从头开始创建索引,则需要省略 DROP_EXISTING = ON 选项。您应该将 CREATE INDEX WITH DROP_EXISTING = ON 视为 ALTER INDEX 操作。它不会创建对象本身。希望这有帮助。
我正在尝试为 Azure SQL 上的 geography
数据类型创建空间索引。这是代码:
CREATE SPATIAL INDEX IX_Shop_LatLong ON Shop(LatLong)
USING GEOGRAPHY_GRID WITH (GRIDS = (LEVEL_1 = HIGH, LEVEL_2 = MEDIUM, LEVEL_3 = MEDIUM, LEVEL_4 = MEDIUM), CELLS_PER_OBJECT = 16, DROP_EXISTING = ON)
我得到的错误是:
Could not find the spatial index 'IX_Shop_LatLong' on table 'Shop'. Either no spatial index with this name exists, or a non-spatial index might be using the same name. Fix the index name, avoiding duplicates. If a relational index has the same name, drop the regular relational index.
我正在尝试提供其他名称,但我遇到了同样的错误。
该错误表明空间索引定义不存在,无法修改,因为您使用的是 DROP_EXISTING = ON 选项。使用此选项,需要存在匹配索引(正确类型),否则您将收到此错误。如果您在 table 上从头开始创建索引,则需要省略 DROP_EXISTING = ON 选项。您应该将 CREATE INDEX WITH DROP_EXISTING = ON 视为 ALTER INDEX 操作。它不会创建对象本身。希望这有帮助。