question

sathishkumar3791 avatar image
sathishkumar3791 asked

how to splitting a word from one column into another column

i have a table in sql server like > location > ---------- > chennaitamilnaduindia > trivendamkerlaindia my Expected output > city state country > chennai tamilnadu india > trivendam kerla india can any one know the answer?
splitnormalizationpl-sql
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
Grant Fritchey avatar image
Grant Fritchey answered
The problem you're facing is that there is nothing from which to work the split function. Since everything, city, state, country, is all in a single string with no breaks, you're going to have a very hard time splitting it apart. The best I can come up with is a suggestion to get a list of city, state, and country, and then do a JOIN to that list with a LIKE function to find the pieces. But, that's going to hit issues if there's ever a city named Kerla as well as a State named Kerla (just picking an example).
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.