以欧元金额替换字符
第一篇文章,希望我包含正确的内容,如果没有,请道歉。
我有多种货币金额正在导入数据库中。其中一些是欧元,因此交换“,”和“。”小数点和 1,000 分隔符的位置。我需要将“,”替换为“.”对于美分,但无法找到正确的替换/填充方法来做到这一点。
例如,我有 10.000,00 欧元,我需要它来读取 10,000.00 欧元,我已更新该字段,因此“,”已修复。任何建议表示赞赏。 谢谢
First post so hope I include the right stuff, apologies if not.
I have a mix of currency amounts Im importing into a database. Some of them are EUR and as such swap the "," and "." positions for decimal and 1,000 separator. I need to replace the "," to a "." for the cents but cant find the right replace/stuff method to do it.
For example I have 10.000,00 EUR I need it to read 10,000.00 EUR I have updated the field so the "," is fixed. Any suggestions appreciated.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果我们假设您正在谈论 Microsoft SqlServer 以及存储在 char/varchar 列上的金额数据: AmountCol 以指定格式:'10.000,00' 并且您希望以其他格式检索此数据,则可以使用 REPLACE 函数:
“^”符号的使用是任意的,以确保我们不会转换“.”与 ',',然后将所有 ',' 字符转换为 '.',最后为 '10.000.00'。
如果上述假设错误,您需要提供更多详细信息,例如您正在使用哪个数据库、您从什么介质导入、您使用什么工具导入、目标列的数据类型是什么等?
If we assume that you are talking about Microsoft SqlServer and the amount data stored on char/varchar column: AmountCol in the specified format: '10.000,00' and you want to retrieve this data in the other format, you can use the REPLACE function:
The use of the '^' symbol is arbitrary, to make sure that we don't convert '.' with ',' and then all ',' chars to '.', ending up '10.000.00'.
If the assumptions above are wrong you need to provide more detail, like which database you are using, what medium you are importing from, what tool do you use to import, what is the datatype of the target column, etc?