Select to view content in your preferred language

insertRow into SQL server

1043
3
Jump to solution
08-20-2013 01:35 AM
AlexandreDinnouti
Deactivated User
I would like to insert an multidimensional array of points into a dataset stored in a SQL Server. Do you guys have a sample code showing how to connect and insertRow?

thanks
Alex
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
JakeSkinner
Esri Esteemed Contributor
Yes, you can use the InsertCursor with an SDE connection file.  Just set your env.workspace variable to wherever your .sde file is.  Ex:

import arcpy from arcpy import env env.workspace = r"Database Connections\GIS.sde"

View solution in original post

0 Kudos
3 Replies
JakeSkinner
Esri Esteemed Contributor
If you are looking to insert a row into a SQL Server table, take a look at the ArcSDESQLExecute class.  If you are looking to insert a row into an SDE geodatabase table, you can use the InsertCursor function.
0 Kudos
AlexandreDinnouti
Deactivated User
I saw examples of InsertCursor (arcpy.da) being used to point to a system path, but never to an SQL Server. Is that possible?

thanks,
Alex.
0 Kudos
JakeSkinner
Esri Esteemed Contributor
Yes, you can use the InsertCursor with an SDE connection file.  Just set your env.workspace variable to wherever your .sde file is.  Ex:

import arcpy from arcpy import env env.workspace = r"Database Connections\GIS.sde"
0 Kudos