使用+和 - 显示货币类型 [英] Display Money Type using + and -

查看:69
本文介绍了使用+和 - 显示货币类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这可能是一个简单的问题,但我已经阅读了大约一半的时间,并且没有结果进行实验。


我只是想要我的查询结果显示特定字段

键入money使用+和 -


消耗数据的程序在正数上需要+,在负数时需要
。我希望在视图中执行它,而不是使用插入数据库的VB应用程序处理结果。


谢谢

This may be an easy question but I''ve been reading for about a half
hour and experimenting without results.

I simply want the results of my query to display a specific field that
is typed "money" using + and -

The program that consumes the data expects + on positive numbers and -
on negative. I was hoping to do it in the view instead of processing
the results with the VB application that interogates the DB.

Thanks

推荐答案

它应该在VB中完成

但你可以这样做


选择案例字段时< 0然后'' - ''+转换(varchar,字段)else''+''+

转换(varchar,field)从TableA结束MoneyField


我不知道你想要显示什么0.00
http:// sqlservercode .blogspot.com /

It should be done in VB
but you can do it like this

select case field when < 0 then ''-'' + convert(varchar,field) else ''+'' +
convert(varchar,field) end MoneyField from TableA

I don''t know whatt you want to display for 0.00
http://sqlservercode.blogspot.com/


为什么要在数据库中执行此操作?为什么你在桌子上使用MONEY

栏?


-

David Portas

SQL Server MVP

-

Why would you do this in the database? And why are you using a MONEY
column in your table?

--
David Portas
SQL Server MVP
--


是啊....我想你是对的 - 它应该是在VB中完成。


我试图按下服务器的输出,而不是期望每个开发人员(可能使用不同的工具)来自b $ b。滚动他们的

拥有惯例。


谢谢

Yeah.... I guess you''re right - it should be done in VB.

I was trying to massage the output from the server rather than expect
each developer (who may be using different tool) from "rolling their
own" routines.

Thanks


这篇关于使用+和 - 显示货币类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆