在sql中,如何将查询到的字段进行四舍五入后显示出来
在sql中,如何将查询到的字段进行四舍五入后显示出来
比如:
select Price from F --Price是nvarchar(50)类型的 Price的值和123243.2324类似
求解:如何通过四舍五入后保留两位小数???
[解决办法]
declare @F table (Price numeric(10,4))insert into @Fselect 123243.2324 union allselect 3243.2354 union allselect 22.2344select CAST(Price AS DECIMAL(18,2)) AS Price from @F/*Price---------------------------------------123243.233243.2422.23*/