harperb

List fields from fc and selectively udpate to fields in SQL Server table

Discussion created by harperb on Feb 27, 2013
In this code, I'm trying to take the the contents of two fields from a particular gdb feature class and bring add them to two existing fields in a SQL Server database connection.  The two database fields are empty.  I've attached some code below that is trying to use the update cursor command and list fields in tandem, but I get a 99999 error and am not sure what happened and where to correct the code.

Any help would be greatly appreciated
-Ben

import arcpy
from arcpy import env
import os

arcpy.env.overwriteOutput = True


rows = arcpy.UpdateCursor("Database Connections\\Connection to dbsql205DEV.sde\\GG_FMDATA_DEV.dbo.GIS_XYcoordinates")
fields = arcpy.ListFields("\\\\nas3\\gisshare\\dev\\gisdata\\PythonScripts\\facilities_test_bh\\Coord_create.gdb\\bldgprop_test_StPl3601")
for row in rows:
    for field in fields:
        value = row.getValue(field)
        if value == Xcoordinate1:
            row.setValue(field,Xcoordinate)
            rows.updateRow(row)



rows = arcpy.UpdateCursor("Database Connections\\Connection to dbsql205DEV.sde\\GG_FMDATA_DEV.dbo.GIS_XYcoordinates")
fields = arcpy.ListFields("\\\\nas3\\gisshare\\dev\\gisdata\\PythonScripts\\facilities_test_bh\\Coord_create.gdb\\bldgprop_test_StPl3601")
for row in rows:
    for field in fields:
        value = row.getValue(field)
        if value == Ycoordinate1:
            row.setValue(field,Ycoordinate)
            rows.updateRow(row)

Outcomes