autoexcrement (11/30/2010)
sharath.chalamgari (11/30/2010)
Simple and nice article,some time back i was working on validating a column in the database and i came across this issue and we had this function to validate.
This poster brings up a good point: "-" and ".".
I have used a similar function but I had to make sure that the string could be converted into a float.
So there must be additional checks:
"-" and "+" only at the first position
"." allowed only once
TestCases:
select cast('+1.0'as float) -- OK
select cast('-1.0'as float) -- OK
select cast('1.0-'as float) -- NOK
select cast('1.0+'as float) -- NOK
select cast('.5' as float) -- OK
select cast('5.' as float) -- OK
select cast('5.5.5' as float) -- NOK