Created simple function to remove few special character but it is returning with junk values:
ALTER FUNCTION [dbo].[fnRemoveInvalidChars] (@Temp VARCHAR(300))
RETURNS VARCHAR(300)
BEGIN
SELECT @Temp = REPLACE(REPLACE(@Temp, ',', ''), '.', '') /* removing , and .*/
return @Temp;
END
Returning values are like below:
58,871,300.00 => 5.88713e+007
55,146,000.00 => 5.5146e+007
8,296,000.00 => 8.296e+006
Important to note that, the value i am passing can be Varchar, decimal,int or float and because of that it is not working correctly.
set @Temp = CONVERT(VARCHAR,@Temp);? Do you just want to remove'.'and','from a string?