How to convert varchar to decimal(38,2)?
问题 I have a problem converting from a varchar '000000113754' to decimal 1137.54 I'm comparing two expressions: 1. select STUFF('000000113754', LEN('000000113754') - 1, 0, '.') 2. select STUFF([dbo].fn_PrepareNumeric(('000000113754' + '-'), '+','-'), LEN('000000113754') - 1, 0, '.') The function fn_PrepareNumeric just checks for the sign and appends '-' in front if the sign is - . That's all. The problem is that the first expression gives me the correct varchar - 0000001137.54 , and the second