Hi George,
Thanks for the reply. I am on holiday this week, don't have access to the code at work.
The code below is a rough copy of the logic used. The only error that I get from Create Relationship is:
"the feature is not Registered with the db"
# Import system modules
import arcpy
from arcpy import env
# Set environment settings
env.workspace = "D:/users/user"
## Copy Data
## Copy the Spatial View to Featyre
database = "TESTDB Connection.sde"
arcpy.CopyFeatures_management("TESTDB.SpTable_JNS_VW", "TESTDB.SpTable_JN_VW")
##Create Relationship
SptTbl = "TESTDB.SpTable_JN_VW"
SptData = "TESTDB.Data_JN"
# Create simple relationship class between SpTable_JN layer
# and Data_JN table with additional parcel owner information
SpTable = "SptTbl"
relClass = "TESTDB.EQUIP_RelClass"
forLabel = "SpTable.EQUIP_ID"
backLabel = "SptData.SW_ID"
primaryKey = "SpTable.EQUIP_ID"
foreignKey = "SptData.SW_ID"
arcpy.CreateRelationshipClass_management(SpTable,
SptData,
relClass,
"SIMPLE",
forLabel,
backLabel,
"BACKWARD",
"ONE_TO_MANY",
"NONE",
primaryKey,
foreignKey)