但是有時候會有需要計算到小數後幾位時可使用CAST函數進行型態轉換!
select cast(10 as decimal(10,5))/cast(3 as decimal(10,5)) --------------------------------------- 3.3333333333333333
select ROUND(cast(10 as decimal(10,5))/cast(3 as decimal(10,5)),5) --------------------------------------- 3.3333300000000000
select Convert(decimal(10,5),ROUND(cast(10 as decimal(10,5))/cast(3 as decimal(10,5)),5)) --------------------------------------- 3.33333參考自:Microsoft TechNet-CAST 和 CONVERT