Ver originalSELECT[customer2], CASE WHEN charindex('-',[customer2])=0 then ([customer2]) else ltrim (rtrim(substring([customer2],0,charindex('-',[customer2])))) end from [RIA].[dbo].[TestRachel] where [user]='146_250_105_147'