I need to auto populate field data in one table using the reference of other table. I tried this using some sql scripting in arcpy. using the script I was able to pull the data from table but not modifying of the data.
import arcpy # Use a connection file to create the connection egdb = r'C:\Users\mlgsadmin\AppData\Roaming\ESRI\Desktop10.6\ArcCatalog\Connection to 10.72.15.186.sde' egdb_conn = arcpy.ArcSDESQLExecute(egdb) table_name = 'SDE.BPPL_Overall_Status' field_name = 'Status' sql = ''' UPDATE SDE.BPPL_Overall_Status SET BPPL_Overall_Status.Clearing = Cleraing_ROW_0_175_Km.STATUS from BPPL_Overall_Status Inner Join Cleraing_ROW_0_175_Km ON BPPL_Overall_Status.Start_mts=Cleraing_ROW_0_175_Km.Start_mts '''.format(field_name, table_name) egdb_return = egdb_conn.execute(sql)
This was the script used.
Looking at how you are building the SQL statement, you define table_name and field_name, but neither of those variables are actually being used in the statement. What do you want the final SQL statement to look like? And if what you have is what you want, then what do you think is happening with field_name and table_name?