Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

How do i display numbers to 2 decimal places in sql server

  • 23-09-2008 3:09pm
    #1
    Closed Accounts Posts: 196 ✭✭


    How do i display numbers to 2 decimal places in sql server


    i have tried
    select cast(100 as decimal) as cost

    ie i want 100.00


Comments

  • Registered Users, Registered Users 2 Posts: 2,494 ✭✭✭kayos


    SELECT CONVERT(MONEY,100) as cost

    But to be honest would this not be better off in your front end? Say your SQL Server region is set to the UK and your front end is one of those countries that use the 100,00 format...


  • Closed Accounts Posts: 196 ✭✭NedKelly


    when i run this i get it to 4 decimal places
    i only need two

    select CONVERT(MONEY,100) as cost

    100.0000

    i need
    100.00


  • Registered Users, Registered Users 2 Posts: 1,193 ✭✭✭liamo


    Select Cast(100 as Numeric(10,2)) As SomeColName


  • Registered Users, Registered Users 2 Posts: 2,494 ✭✭✭kayos


    NedKelly wrote: »
    when i run this i get it to 4 decimal places
    i only need two

    select CONVERT(MONEY,100) as cost

    100.0000

    i need
    100.00


    Again this is down to the settings. Works to two decimal places on my env.

    Still think you should leave this off to the front end.


Advertisement