1

Possible Duplicate:
Split string in SQL

I have a field that contains values like:

xxx-xxxx-xx-xx

xxxx-xx-xxxx-x

In excel, if I used the "text to columns" feature (with the "-" as a delimiter), I would end up with:

xxx xxxx xx xx

xxxx xx xxxx x

I am trying to accomplish the same effect in Sql Server 2008 using sting functions like charindex etc but just can't seem to get the hang of it.

Thanks in advance for your help. John

Community
  • 1
  • 1
user131602
  • 21
  • 1
  • This kind of topic has been covered by a multitude of previous questions and blog articles, Aaron Bertrands is a very good one to read : http://www.sqlperformance.com/2012/07/t-sql-queries/split-strings – Andrew Nov 16 '12 at 13:41

0 Answers0