I am trying to write a list of items to a new table in Arc. When I attempt to add a new row to an Arc table, I get the following error:
Runtime error
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\__init__.py", line 1170, in InsertCursor
return gp.insertCursor(dataset, spatial_reference)
File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\geoprocessing\_base.py", line 369, in insertCursor
self._gp.InsertCursor(*gp_fixargs(args, True)))
RuntimeError: ERROR 999999: Error executing function.
An invalid SQL statement was used.
An invalid SQL statement was used. [Table]
An invalid SQL statement was used. [SELECT * FROM Table]
I have narrowed down the error to using arcpy.InsertCursor()
on a table created by using the arcpy.CreateTable_management()
tool. I have recreated the problem using this code snippet:
tbl = arcpy.CreateTable_management (r'C:\GeoDatabase.gdb',"Table")
arcpy.AddField_management (tbl, "NewField", "FLOAT")
irows = arcpy.InsertCursor (tbl)
I get an error as soon as I try to execute the last line. This seems very simple, so I feel like I must be overlooking something. However, the InsertCursor tool does not use SQL statements, so the error is confusing to me. Can anyone help me understand how to bypass this error. If you know a better way to take a list of items and write them to a new table in Arc, I am all ears.
Thanks for the help.