1

The following entry almost nails it on the head but not quite: How to get the 1st value before delimiter in sql server

Have a column that returns the following: Fruits Apple.Orange.Lemon.Grape

Would like to return: sample output

Unfortunately, I'm quite restricted in terms of functions I can use (https://technet.microsoft.com/en-us/library/ms174077(v=sql.110).aspx). Cannot call on a combo of replace or parsename, and cannot create a function, so how can I use the substring / charindex solution to arrive at the output above?

Bohemian
  • 412,405
  • 93
  • 575
  • 722
Dom B
  • 41
  • 1
  • 4
  • Why would you consider calling `parsename()`? That is a SQL Server function and the question is tagged mysql. – Gordon Linoff Feb 21 '16 at 16:01
  • Could there be unlimited number of fruits? – sagi Feb 21 '16 at 16:03
  • Maybe this would help? http://stackoverflow.com/questions/19073500/sql-split-comma-separated-row – Andrew Feb 21 '16 at 16:10
  • No only four fruits @Sagi – Dom B Feb 21 '16 at 16:11
  • @DomB so the table allways contain one row like this: Apple.Orange.Lemon.Grape ? – sagi Feb 21 '16 at 16:14
  • That's correct @Sagi – Dom B Feb 21 '16 at 16:14
  • @DomB posted an answer – sagi Feb 21 '16 at 16:18
  • As per the [*How to ask* guide](https://stackoverflow.com/help/how-to-ask), please [**do not** post images of code, data, error message, etc](https://meta.stackoverflow.com/questions/285551). Instead, copy or type the text into your question, [formatted as code](https://meta.stackoverflow.com/questions/251361/how-do-i-format-my-code-blocks/251362#251362). Reserve the use of images for diagrams or demonstrating rendering bugs; things that are impossible to describe accurately via text. – Bohemian Jun 11 '22 at 20:09

0 Answers0