--SQL中轉換money類型數值轉換為字符串問題,直接轉換就轉為兩位了,所以需要做一下處理。具體請看下述sql實例。
1 create table #test(price money) 2 3 insert into #test values (45.2525) 4 5 6 7 select cast(price as varchar(50)) from #test --輸出45.25 四位小數只有兩位了 8 select convert(VARCHAR,price) from #test --輸出45.25 四位小數只有兩位了 9 10 select convert(VARCHAR,45.2525) --輸出為45.2525 四位小數 11 12 13 14 select cast(CAST(price AS DECIMAL(20,4)) as varchar(50)) from #test --輸出為45.2525 四位小數 15 select convert(VARCHAR,convert(DECIMAL(20,4),price)) from #test --輸出為45.2525 四位小數 16 17 DROP TABLE #test