Convert Varchar into numeric

  • Hi

    I have a varchar value like 0.365 that i want to do calculations with. How do I turn this value into a datatype that I can calculate??

     

    How do I convert it??

     

    Regards Mattias

  • Hi Mattias,

    Have you tried CONVERT(decimal,ColumnName). I used a decimal here as your exmaple in your post showed 0.365

    Anton

  • You might like to qualify 'decimal' with 'precision' and 'scale' arguments - eg decimal(9,5) gives you 9 decimal positions per number to play with - up to five of them to the right of the decimal point - check BOL for more details.

    The advantage here is that less memory is used (5 bytes, instead of the default 17 per decimal number)

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply