I have an issue where I am trying to grab the leftmost part of a field when the field has a '-' character in it. I have followed several threads and when I implement the solutions, I still get errors. Here is one of them I am using.LEFT(LTFLS.STOCK_LOCATION, CHARINDEX('-', LTFLS.STOCK_LOCATION)-1)When I do, I get the following error message: Msg 537, Level 16, State 2, Line 1Invalid length parameter passed to the LEFT or SUBSTRING function.However, the sytax is identical to several threads I have reviewed.I have also tried using:CAST(CASE WHEN CharIndex('-',LTFLS.STOCK_LOCATION)=0 THEN LTFLS.STOCK_LOCATION ELSE LEFT(LTFLS.STOCK_LOCATION,CharIndex('-',LTFLS.STOCK_LOCATION)-1) AS VARCHAR)or CAST(CASE WHEN CharIndex('-',LTFLS.STOCK_LOCATION)=0 THEN LTFLS.STOCK_LOCATION ELSE LEFT(LTFLS.STOCK_LOCATION,CharIndex('-',LTFLS.STOCK_LOCATION)-1))Both of them give me an Incorrect syntax error near ) or near the AS. I have double checked and each close parenth has an open parenth.Any help would be greatly appreciated.