Skip to content
Advertisement

Extract string from one character to another in SQL and remove leading and trail spaces

Hi I have the following strings in a SQL table Cities:

I am hoping to extract and create a new column so my desired result is:

I have tried something like:

But thats a fixed width of 10 characters, rather I would like the string from the / to the closed brackets )

Any help would be much appreciated!

Thanks very much

Advertisement

Answer

Rather than use a fixed length why not just use charindex like you have done but for both delimiters?

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement