Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
rsmohankumar
Starting Member
11 Posts |
Posted - 2015-04-08 : 14:01:50
|
Hi, I have data like 'US.USA.Florida.Miami'. I need to split this string as below Continent Country State Location =========== ========= ========= ============ US USA Florida MiamiDelimiter is dot '.'. Kindly let me know is there any chance to do this using the sql server built in functions.Thanks in advance. |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2015-04-08 : 14:03:42
|
Yes you can use the PARSENAME function.Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
rsmohankumar
Starting Member
11 Posts |
Posted - 2015-04-09 : 01:29:42
|
Hi Tara, I have data like this 'US.USA.Florida.Miami.'. I missed the dot at the end. If we have the dot at the end,PARSENAME function is not working. Is there any other built in function we can handle this. |
|
|
rsmohankumar
Starting Member
11 Posts |
Posted - 2015-04-09 : 02:57:22
|
I got the output using your inputs. PARSENAME(STUFF('US.USA.FLORIDA.MIAMI.',LEN('US.USA.FLORIDA.MIAMI.'),LEN('US.USA.FLORIDA.MIAMI.'),''),2)Thanks |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2015-04-10 : 08:06:15
|
orPARSENAME(LEFT('US.USA.FLORIDA.MIAMI.',LEN('US.USA.FLORIDA.MIAMI.')-1)MadhivananFailing to plan is Planning to fail |
|
|
|
|
|