I need some help in writing a stored procedure that will give me the last column. I need to calcuate the New Name, which depends on wether there is a parent id or not. The parent id can keep going longer. But this is just an example. So essentially I need a stored procedure to calculate the last column which is New Name
I am attaching the table in an excel file just for convenience. Any help would be appreciated.