Hello,
I'm trying to convert a standard SQL query to a LINQ to SQL query.
I was wondering what the LINQ equivalent of the T-SQL function STR() is?
STR (T-SQL)
Returns character data converted from numeric data.
Syntax STR(float_expression[, length[, decimal]])
Arguments float_expression Is an expression of approximate numeric (float) data type with a decimal point. Do not use a function or subquery as the float_expression in the STR function. length Is the total length, including decimal point, sign, digits, and spaces. The default is 10. decimal Is the number of places to the right of the decimal point. Return Types char
I'm trying to explicitly set the number of decimal places for a field.
Please and thank you!
(I've tried Googling around, but Google keeps on translating str as "string" even with double quotes aroud str)
EDIT
I've tried .ToString("N2") which is exactly what I want, but LINQ isn't able to translate it.
EDIT
Clarification, I have a SQL field that is a double. I have to append/truncate to 2 decimal places. After that, I will append it with an additional string. So therefore, I believe I do need to convert it to a string. This is because I need to compare that generated string with another field that is of type varchar. (I know this is idiotic because they should be the same type, etc, but I can't change the design of the database).