I had this issue and went the following route:
If the field that is the ID is a number field, create a view for creating the next ID in sequence in SQL Server such as:
SELECT MAX(FieldName) + 1 AS NEXT_ID
FROM owner.TABLENAME
Then, in Model Builder, I created a model to assign the ID.
Get Field Value: Using your view that you created: Field is NEXT_ID, Data Type is Long
Make a Feature Layer of the feature class you are trying to update, then Select By Attribute as "FieldName IS NULL", then calculate "FieldName" with the "Value" from the next available ID
Calculate Field (Python 9.3):
Expression:
autoIncrement()
Code Block:
rec=0
def autoIncrement():
global rec
pStart = %Value%
pInterval = 1
if (rec == 0):
rec = pStart
else:
rec += pInterval
return rec
From here, you can import the Model Builder model into a Python script as:
arcpy.ImportToolbox("C:\Path\To\Your\Toolbox\AutoID.tbx","test")
arcpy.ModelName_test()
Make sure you add _test() to the end of your model name and "test" at the end of your toolbox.
Brian