开发者

Convert a string field with pennies into a dollar amount with 2 decimal places in SQL Server

I have a field in a table as nvarchar(10), which is used to store a value in pennies. For example, $23.50 is stored as开发者_JS百科 "2350".

I need to return this value to the program in Money format. How would I do that in the Select statement?


SELECT CAST (IntAmount / 100.00 as MONEY)


 cast(cast (pennies as numeric(16,2))/100 as money)


Select convert(money, field/100, 0) from table
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜