I have a table CARM with fields (columns) ID and AREA_DESC.
In the AREA_DESC field, I have some values that show as follow:
AREA_DESC
--------------
Felisberto-001
Ana
Mark-02
Maria
--------------
What I would like to do, is to display these values in this way:
AREA_DESC
--------------
Felisberto
Ana
Mark
Maria
--------------
As you may notices, I would like to only display the string prior to the dash -
only. In other words, I would like to drop the dash -
and numbers after the dash -
This is the query I have tried so far:
SELECT ID, AREA_DESC ,SUBSTRING(AREA_DESC,0,CHARINDEX('-', AREA_DESC)) as area
FROM CARM