I have a field called subjects and the data looks like this:
ALJ Diane Davis - WCF
I want my end result to be:
ALJ Diane Davis
I am trying to get all the data to left of the "-" I am using Advantage SQL which I am new too.
The example below using the RIGHT
function gets me everything to the right which works if i wanted that, but i dont always know the exact number of characters for the way that i am wanting my data to end up like.
Thanks in advance
left(appts.subject,charindex('-',appts.subject)
left(appts.subject,char('-',appts.subject)-1)
right(rtrim(appts.subject),6)
Doesn't this work?
If this fails because not all subjects have a
-
, then:The above works in Sybase. In Advantage SQL, I think you need
location
:This should give you result. Locate is the function works in Adavantage-Sql. You can use this link