Trim string based on characters

Viewed 75

I have strings like

WebApp - 10148

Smart - App - 1458

Expected Result

WebApp

Smart - App

I want to trim the characters from - to numbers from right.

I have tried the below query and the result is this

select LEFT(app+' - ', CHARINDEX(' - ',app+' - ')-1) from repository

WebApp
Smart

Can anyone assist me to sort this?

2 Answers
Related