0

I have in my SQL Server 15.0.4073.23 DB about 2000 strings that meet the following format:

1 TEST-8000-38-2
2 ANOTHERTEST-9000-401-7
3 TEST2-10
4 ANOTHERTEST

I need to split them in separate columns based on the hyphens through a query that doesn't change the table's records, to obtain something like that:

Expected query result

Any suggestions?

I have made a few attempt with SUBSTRING, LEFT, RIGHT, CHARINDEX and even PARSENAME, which was the closest by I was having some issues declaring the variable by replacing the hyphens with dots.

Thom A
  • 88,727
  • 11
  • 45
  • 75
glef
  • 1
  • 1

0 Answers0