declare @number varchar(20), @totlen integer, @theIndex integer, @FinalValue as varchar(10)
Set @number = '3333*94449'
Set @totlen = Len(@number)
Set @theIndex = CHARINDEX('*',@number)
Set @FinalValue = Right(@number, @totlen - @theIndex)
Select @number as 'The Value', @totlen as 'Total Length', @theIndex as 'The Index', @FinalValue as 'Final Value'
Hope this helps.
|