문제

I am using MS SQL 2008 to develop one system with Classic ASP.

I want to show 3 Decimal Places the field Datatype is money. I got answer from this http://www.sqlusa.com/bestpractices2005/moneyformat/ .

I use like this in my SQL Statement :

        CONVERT(VARCHAR, CAST(Sell_Price AS Decimal(19, 3))) AS Unit_Price

What I want to know is: Is there more effective way(in performance and usage) than my current one? If there is, please show me. Thanks in advance!

Regards,

RedsDevils

도움이 되었습니까?

해결책

Personally, I'd consider returning the value as-is unformatted from the database and formatting it for display in the UI instead - leave the formatting up to the front end. After all, the db doesn't know for what use the data it returns is being used for - e.g. something else that runs the query may want the full accuracy returned so would save having multiple different versions.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top