The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!
CREATE FUNCTION ConvertFract
(
@Val varchar(10)
)
RETURNS numeric(20,10)
AS
BEGIN
declare @temp varchar(10)
declare @ret numeric(20,10)
declare @frac numeric(20,10)
select @temp = ltrim(rtrim(@val)),@frac=0
if charindex(' ', @temp)<> 0
begin
select @ret = convert(numeric(20,10),SUBSTRING(@temp,1,charindex(' ', @temp)-1))
Select @temp = replace(@temp,SUBSTRING(@temp,1,charindex(' ', @temp)),'')
end
if charindex('/', @val)<> 0
begin
select @frac = convert(numeric(20,10),SUBSTRING(@temp,1,charindex('/', @temp)-1))
Select @temp = replace(@temp,SUBSTRING(@temp,1,charindex('/', @temp)),'')
select @frac = @frac / convert(numeric(20,10),@temp)
end
RETURN @ret + @frac
END
Alter FUNCTION ConvertFract
(
@Val varchar(10)
)
RETURNS numeric(20,10)
AS
BEGIN
declare @temp varchar(10)
declare @ret numeric(20,10)
declare @frac numeric(20,10)
select @temp = ltrim(rtrim(@val)),@frac=0, @ret = 0
if charindex(' ', @temp)= 0 and charindex('/', @temp)= 0
select @ret = convert(numeric(20,10),@temp)
if charindex(' ', @temp)<> 0
begin
select @ret = convert(numeric(20,10),SUBSTRING(@temp,1,charindex(' ', @temp)-1))
Select @temp = replace(@temp,SUBSTRING(@temp,1,charindex(' ', @temp)),'')
end
if charindex('/', @val)<> 0
begin
select @frac = convert(numeric(20,10),SUBSTRING(@temp,1,charindex('/', @temp)-1))
Select @temp = replace(@temp,SUBSTRING(@temp,1,charindex('/', @temp)),'')
select @frac = @frac / convert(numeric(20,10),@temp)
end
RETURN @ret + @frac
END