locked
How can i Formate Money Datatype Value RRS feed

  • Question

  • hi i have this query 

    string query = @"SELECT Products.ProductID,Products.ProductName,Products.ProductQuantity,FORMAT(ProductNetPrice,'0') AS OrdersIN.ProductNetPrice ,Products.ProductPhoto,Products.Note FROM Products INNER JOIN OrdersIN ON Products.ProductID = OrdersIN.ProductID WHERE Products.ProductName = @ProductName  ";
    
    my scenario is i have inner join column its money type and always shows me value like that 100.0000  thats so bad how can i use format to change it 

    i need help and also i need to know its by this where clause my parameters will work depend on my choice i just wanna know is the WHERE clause work fine like that after ON Clause 
    Sunday, October 11, 2009 7:18 PM

Answers

  • I hope you are trying to convert Money datatype to int. Check out this thread for similar question.

    http://stackoverflow.com/questions/532351/how-do-i-convert-from-a-money-datatype-in-sql-server

    Hope this helps...

    Thanks,
    Veera Reddy
    • Marked as answer by HESHAM HEMDAN Monday, October 12, 2009 2:47 AM
    Monday, October 12, 2009 2:37 AM
  • String query = @"SELECT Products.ProductID,Products.ProductName,Products.ProductQuantity, convert(int, round(OrdersIN.ProductNetPrice, 0)),Products.ProductPhoto,Products.Note FROM Products INNER JOIN OrdersIN ON Products.ProductID = OrdersIN.ProductID WHERE Products.ProductName = @ProductName "; this query is work
    • Marked as answer by HESHAM HEMDAN Monday, October 12, 2009 2:50 AM
    Monday, October 12, 2009 2:48 AM

All replies

  • Which column are you trying to format?
    Abdallah, PMP, MCTS
    Sunday, October 11, 2009 7:27 PM
  • i try to format the column joined from OrdersIN Table called ProductNetPrice

    as you can note i send you query include a fail try of format method but wont work ;)
    Sunday, October 11, 2009 11:09 PM
  • What is the datatype of this field ProductNetPrice, and in what format you want it?
    An example would be great.

    Thanks

    Abdallah, PMP, MCTS
    Monday, October 12, 2009 12:26 AM
  • I hope you are trying to convert Money datatype to int. Check out this thread for similar question.

    http://stackoverflow.com/questions/532351/how-do-i-convert-from-a-money-datatype-in-sql-server

    Hope this helps...

    Thanks,
    Veera Reddy
    • Marked as answer by HESHAM HEMDAN Monday, October 12, 2009 2:47 AM
    Monday, October 12, 2009 2:37 AM
  • String query = @"SELECT Products.ProductID,Products.ProductName,Products.ProductQuantity, convert(int, round(OrdersIN.ProductNetPrice, 0)),Products.ProductPhoto,Products.Note FROM Products INNER JOIN OrdersIN ON Products.ProductID = OrdersIN.ProductID WHERE Products.ProductName = @ProductName "; this query is work
    • Marked as answer by HESHAM HEMDAN Monday, October 12, 2009 2:50 AM
    Monday, October 12, 2009 2:48 AM