Monday, February 20, 2012

Money Data Type

Recently any query run that calls for a filed of the money data type has started displaying all four decimal places. The only thing that appears to have changed is the hotfix referenced in MS04-16 (Deals with Direct X) was applied to the server. As far
as I can tell the money data type has always had a scale of 4. Does anyone know why our queries are showing all four decimal places now? I guess more importantly does anyone know how to make it return to only displaying 2 decimal places? I already sugg
ested casting the values to decmial data type with a scale of 2, but our developers rejected that idea as there are thousands of stored procedures they would have to go through to do that.
Thanks in advance,
Jason
Jason,
Please differentiate between a value and the presentation of a value. SQL Server returns values (in
binary format) and the client application present those values. Obviously, the programmer of your
client applications didn't bother to define the presentation format and because of that has some
default setting for that dev environment, something which changed with the security fix. But SQL
Server does not and cannot present any data. The client application does. This is where you have to
go hunting.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Jason Szotak" <Jason Szotak@.discussions.microsoft.com> wrote in message
news:E5816A4C-F985-486B-AF01-0718C80D095C@.microsoft.com...
> Recently any query run that calls for a filed of the money data type has started displaying all
four decimal places. The only thing that appears to have changed is the hotfix referenced in
MS04-16 (Deals with Direct X) was applied to the server. As far as I can tell the money data type
has always had a scale of 4. Does anyone know why our queries are showing all four decimal places
now? I guess more importantly does anyone know how to make it return to only displaying 2 decimal
places? I already suggested casting the values to decmial data type with a scale of 2, but our
developers rejected that idea as there are thousands of stored procedures they would have to go
through to do that.
> Thanks in advance,
> Jason
|||Tibor,
Thanks for the response. I could use a little more clarification though. When running a stored procedure through query analyer or in the display of a view through enterprise manager the output now shows the four decimal places. It used to show only tw
o. Is it possible that a patch somehow changed this? Like I said before, it started about a week ago and the only thing that has changed in that week is the one hotfix for Direct X was applied. One of our developers thinks that if the display of the va
lue returns to 2 decimal places when running a stored procedure through query analyzer that our problem would be solved. Would you consider this to be an accurate statement?
"Tibor Karaszi" wrote:

> Jason,
> Please differentiate between a value and the presentation of a value. SQL Server returns values (in
> binary format) and the client application present those values. Obviously, the programmer of your
> client applications didn't bother to define the presentation format and because of that has some
> default setting for that dev environment, something which changed with the security fix. But SQL
> Server does not and cannot present any data. The client application does. This is where you have to
> go hunting.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
|||After invetigating this issue further I think the change to the system was that we upgraded the .Net Framework on our webserver to v1.1. The developer that is having the problem is using ASP.Net. We also have applications written in asp. When a stored
procedure is run in query analyzer on a money field the output has the four decimal places, but our asp web page only show the decimals places that are non-zero (the value 100.4000 would display as 100.4 and the value 100.0400 displays as 100.04), so like
you said our development environment has changed and probably has nothing to do with the hotfix. That said, Is there a way to configure the .Net Framework v1.1 to only show two decimal places for money data types?
Jason
"Tibor Karaszi" wrote:

> Jason,
> Please differentiate between a value and the presentation of a value. SQL Server returns values (in
> binary format) and the client application present those values. Obviously, the programmer of your
> client applications didn't bother to define the presentation format and because of that has some
> default setting for that dev environment, something which changed with the security fix. But SQL
> Server does not and cannot present any data. The client application does. This is where you have to
> go hunting.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
|||I don't know the framework enough to guess if or where you do that. I suggest you post that to a
..NET fx group.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Jason Szotak" <JasonSzotak@.discussions.microsoft.com> wrote in message
news:0F1A91C6-AA58-4DBB-AED9-8A2A463B774A@.microsoft.com...
> After invetigating this issue further I think the change to the system was that we upgraded the
..Net Framework on our webserver to v1.1. The developer that is having the problem is using ASP.Net.
We also have applications written in asp. When a stored procedure is run in query analyzer on a
money field the output has the four decimal places, but our asp web page only show the decimals
places that are non-zero (the value 100.4000 would display as 100.4 and the value 100.0400 displays
as 100.04), so like you said our development environment has changed and probably has nothing to do
with the hotfix. That said, Is there a way to configure the .Net Framework v1.1 to only show two
decimal places for money data types?[vbcol=seagreen]
> Jason
> "Tibor Karaszi" wrote:
(in[vbcol=seagreen]
your[vbcol=seagreen]
to[vbcol=seagreen]

No comments:

Post a Comment