Substring Question - Text After Integer or Bracket

by Deasasss   Last Updated September 12, 2019 02:26 AM

I'm trying to clean Full_Name data for a column I have in SQL. I am a complete beginner in SQL, just started learning a while ago.#

There are only three records in the Full_Name column of a table that consists of only that three records:

  1. The NumberTwo Store [PARENT] : [DIST] The NumberOne Store

  2. The NumberTwo Store [PARENT] : [ESTORE] AGM122358896 John Doe

  3. AGM1223554489 Jim Doe

I would like to write a formula that shows the following values, the name at the end of the strings in the records:

  1. The NumberOne Store

  2. John Doe

  3. Jim Doe

As I mentioned, I'm a beginner, below you can see what I've tried.



  ,replace(substring(Full_Name,CHARINDEX (']', Full_Name), LEN(FULL_NAME)),']',' ') as GoodName2

from table

I expect the output to be the values after the last (integer+space key) or if there's no integer then after the last (bracket + space key)

This is my first post here, I hope it's alright.

Tags : sql

Related Questions