SQLTeam.com | Weblogs | Forums

Separating column values


#1

I have a column values like below, one column but separated by |

How can I retrieve values that are only ACH and outpatients


ACH |Emergency |ED Trauma C/D |
ACH |Emergency |ED Trauma Room |
ACH |Emergency |ED Triage |
ACH |Emergency |ED Waiting Room|
ACH |Emergency |ED-Emerg |
ACH |Outpatients |
ACH |Outpatients |ACETS |
ACH |Outpatients |ACH-Hemo |
ACH |Outpatients |ACH-Perito |
ACH |Outpatients |ACH-TESTOP |
ACH |Outpatients |AHS RP01 |


#2

Try this:

select yourcolumn
  from yourtable
 where yourcolumn like 'ACH |Outpatients |%'
;

#3

That is ok, but I need to separate these values in different columns. .


#4

Use Jeff Moden's DelimitedSplit8K