Cast wrong

  • I trying writing a cast but I can't seem to get it correct

    cast((Qr_Respuestas / dt.total) * 100 as numeric(10,2))

    The message says "Invalid or missing expression"


    Jean-Luc
    www.corobori.com

  • What's the entire statement ? There's nothing I can see wrong with the way you cast this.

    test as follows...

    select cast((id/id)*100 as numeric(10,2))

    from syscomments


    Mathew J Kulangara
    sqladventures.blogspot.com

  • Hi

    Try putting the whole calculation in bracket, like this

    select cast(((Qr_Respuestas / dt.total) * 100) as numeric(10,2))

    also you could try

    select cast(((Qr_Respuestas / dt.total) * 100) as decimal(10,2))

    Also, what are the individual fields in the calculation, char,varchar, text??

     

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

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