I'm currently having a problem when using ArcPy (Python 2) to insert a row into a table using a SQL server database., Since this table contains a "Order" field that is a keyword in SQL., here is an example in the names of the fields to insert:
Fields = [‘Id’, ‘Nom’, ‘TypeLayer’, ‘Order’]
And I used arcpy.da.InsertCursor(table_path, Fields) to insert the row.
When I run the script, I got the following error:
RuntimeError : Invalid SQL syntax [[Microsoft][ODBC Driver 17 for SQL Server][SQL Server] Syntaxe incorrecte vers le mot clé ‘Order’]
Then, after researching on the net, I found solutions that say to put the keyword 'Order' in brackets.
Fields = [‘Id’, ‘Nom’, ‘TypeLayer’, ‘[Order]’]
I always had the same error:
RuntimeError : Invalid SQL syntax [[Microsoft][ODBC Driver 17 for SQL Server][SQL Server] Syntaxe incorrecte vers le mot clé ‘Order’]