Decimal SqlParameter strange behaviour

  • Thread starter Thread starter mikicaradojcic
  • Start date Start date
M

mikicaradojcic

I've created SqlParameter with precision = 15, Scale =2 and name =
@param1.
I added it to command which text is:

Begin

SELECT * FROM TABLE WHERE VALUE < @param1
END

if I put param .Value = for example 99.99d it works.
If I put param .Value as 99.00d it breaks with out of range value.

Why does param trunc .00 in decimal value and see value with no
decimal places? Should implicit conversion between c# decimal and
SqlParameter value decimal handle this?
 
I always use

convert(numeric, replace(@valueToPass, ",", "."))

works with 99.00 and 99,00

;-)

--

Bruno Alexandre
Strøby, Danmark

"a Portuguese in Denmark"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top