I have GIS data where the most upstream link on each line is missing an upstream manhole. Is there a SQL script that will allow me to add the upstream nodes to all of these lines automatically?

Thank you!