I have sample data as below format with ID's and name. Name is unique value. Here we can import the data. But during import is that possible in sql query whether the given is already existed then updated the name with old suffix with increment value also along with suffix.
In the below data as Jack is already there then during import I need to update it as Jack_old1 and import the new one as Jack with different ID.
In the below data as Sino is already there then during import I need to update it as Sino_Old2 and import the new one as Sino with different ID.
ID Name
-- ------
1 Jack
2 Smith
3 Sino_Old1
4 Sino
whether the above logic can be achieved through sql query with update query as processing time through java is more.