临时表插入语句的解决方法超过了允许的最大行值

时间:2019-08-09 18:58:19

标签: sql geometry sql-insert declare

我正在尝试创建一个临时表,该表创建多个六边形。但是,六边形(即行)的数量超过了1000行的最大值。该表稍后将根据记录坐标是否落在十六进制的几何范围内而与现有表连接(请参阅我相关的文章Creating a Table with Points from X and Y Coordinates and Joining to a Table of Polygons if Point Withing Polygon

我尝试的变通方法(如此处Temporary Table - Maximum allowed number of 1000 row values所述,进行多次插入)导致insert语句本身出现截断错误。

尝试创建前999行/六边形时,返回所需的结果。

我没有特权直接更改或添加到数据库。

DECLARE @Hex TABLE  --change to temp table?
 (PointGeom geometry, Hex varchar(6))

 INSERT INTO @Hex 
  Values

  (geometry::STPolyFromText('Polygon((7598795.05553838 734372.656,7598217.70526919 735372.656,7597063.00473081 735372.656,7596485.65446162 734372.656,7597063.00473081 733372.656,7598217.70526919 733372.656,7598795.05553838 734372.656))',0),'Hex1'),
(geometry::STPolyFromText('Polygon((7602259.15715352 734372.656,7601681.80688433 735372.656,7600527.10634595 735372.656,7599949.75607676 734372.656,7600527.10634595 733372.656,7601681.80688433 733372.656,7602259.15715352 734372.656))',0),'Hex2'),
(geometry::STPolyFromText('Polygon((7605723.25876865 734372.656,7605145.90849947 735372.656,7603991.20796109 735372.656,7603413.8576919 734372.656,7603991.20796109 733372.656,7605145.90849947 733372.656,7605723.25876865 734372.656))',0),'Hex3'),
(geometry::STPolyFromText('Polygon((7609187.36038379 734372.656,7608610.0101146 735372.656,7607455.30957622 735372.656,7606877.95930703 734372.656,7607455.30957622 733372.656,7608610.0101146 733372.656,7609187.36038379 734372.656))',0),'Hex4'
…
(geometry::STPolyFromText('Polygon((7676737.34187897 721372.656,7676159.99160978 722372.656,7675005.2910714 722372.656,7674427.94080221 721372.656,7675005.2910714 720372.656,7676159.99160978 720372.656,7676737.34187897 721372.656))',0),'Hex999');



 INSERT INTO @Hex 
Values

(geometry::STPolyFromText('Polygon((7680201.44349411 721372.656,7679624.09322492 722372.656,7678469.39268654 722372.656,7677892.04241735 721372.656,7678469.39268654 720372.656,7679624.09322492 720372.656,7680201.44349411 721372.656))',0),'Hex1000'),
(geometry::STPolyFromText('Polygon((7683665.54510925 721372.656,7683088.19484006 722372.656,7681933.49430168 722372.656,7681356.14403249 721372.656,7681933.49430168 720372.656,7683088.19484006 720372.656,7683665.54510925 721372.656))',0),'Hex1001')

0 个答案:

没有答案