create function dbo.getAlphabatesFromAlphanumeric
(
returns varchar(8000)
as
begin
declare @replacementPossition int
set @replacementPossition=(select patindex('%[0-9]%',@alphanumeric))
while (@replacementPossition>0)
begin
set @alphanumeric=(select stuff(@alphanumeric,@replacementPossition,1,''))
set @replacementPossition=(select patindex('%[0-9]%',@alphanumeric))
end
return @alphanumeric
end
-- select dbo.getAlphabatesFromAlphanumeric('123ABC345')
(
@alphanumeric varchar(8000)
)returns varchar(8000)
as
begin
declare @replacementPossition int
set @replacementPossition=(select patindex('%[0-9]%',@alphanumeric))
while (@replacementPossition>0)
begin
set @alphanumeric=(select stuff(@alphanumeric,@replacementPossition,1,''))
set @replacementPossition=(select patindex('%[0-9]%',@alphanumeric))
end
return @alphanumeric
end
-- select dbo.getAlphabatesFromAlphanumeric('123ABC345')
No comments:
Post a Comment