decimal point in SQL Server -


I tried to calculate a calculation in SQL Server and recover the value with 2 decimal point. However, it always gives me the value in 0 for 2 decimal point. Does anyone know what is happening there?

Example:

  Select Convert (Decimal (5,2), ((2 * 100) / 1 9), 2) Clients 'Exam'  

Returns are always 10.00 instead of 10.53

SELECT Convert (Decimal (5,2), ((2 * 100.0) / 1 9), 2) As a 'Customer Test'

Result: < / P>

  10.53  

I chose 100% to change 100% because I'm guessing you're trying to calculate one percent and that 100 in your final query Ntr be hardcoded. I'm guessing that the other two values ​​(2 and 19) will later change to read from the integer fields in your table.


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -