U P 30t -2494..
Now we don’t want that ‘–‘ and we don’t
want ‘..’ How to do it ?
ALTER function [dbo].[fn_Get_vehicle_no]
(
@vehicle_no as varchar(100)
)
returns varchar(100)
AS
BEGIN
Declare @length INT, @Flag INT, @strvehicleno VARCHAR(50),@OUTPUTPARAM varchar(100)
SET @Flag=1
SET @strvehicleno=''
SET @length = LEN(@vehicle_no)
WHILE (@Flag <= @length)
BEGIN
--print @vehicle_no
--print @Flag
IF(ASCII(substring(@vehicle_no,@Flag,1))>=48 and ASCII(substring(@vehicle_no,@Flag,1))<=57)
BEGIN
--print 'insideNo'
SET @strvehicleno = @strvehicleno + substring(@vehicle_no,@Flag,1)
--print @strvehicleno
END
IF(ASCII(substring(@vehicle_no,@Flag,1))>=65 and ASCII(substring(@vehicle_no,@Flag,1))<=90)
BEGIN
--print 'insideCaps'
SET @strvehicleno = @strvehicleno + substring(@vehicle_no,@Flag,1)
--print @strvehicleno
END
IF(ASCII(substring(@vehicle_no,@Flag,1))>=97 and ASCII(substring(@vehicle_no,@Flag,1))<=122)
BEGIN
--print 'insideSmall'
SET @strvehicleno = @strvehicleno + substring(@vehicle_no,@Flag,1)
--print @strvehicleno
END
SET @Flag = @Flag + 1
END
set @OUTPUTPARAM = rtrim(ltrim(lower(@strvehicleno)))
return @OUTPUTPARAM
END
--select [dbo].[fn_Get_vehicle_no]('U P
30t -2494..')
No comments:
Post a Comment