473,461 Members | 1,764 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

My Float had become Decimal (38, 5)

6
Hi All,

I have a query that refers to a value in a table that is stored as a float like this:

Expand|Select|Wrap|Line Numbers
  1. VIEW [dbo].[v_cash_sub] AS
  2.  
  3. SELECT po_account,
  4.  SUM(po_quantity  ) as cash
  5.  FROM dbo.position
  6.   INNER JOIN dbo.security
  7.    ON se_id = po_security
  8.  WHERE se_cash <> 0
  9.  GROUP BY po_account
  10.  
And the SSMA tells me that this view had po_account (INT), po_quantity (float).

I enquire in a different view:
Expand|Select|Wrap|Line Numbers
  1. CREATE VIEW [dbo].[v_cash_test] AS
  2. SELECT
  3.  po_account as vc_account,
  4.  COALESCE(cash, 0) as vc_cash_current
  5.  
  6.  FROM  dbo.v_cash_sub 
  7.  
(I simplified the problem for publishing purposes, of course there are more joins in the real life view, and because they are left outer I needed the COALESCE)
and it tells me that I have:
po_account (INT) -correct
vc_cash_current (DECIMAL (38, 5))
Has anyone got any idea why?
(Yes, I could change the float to decimal by casting, I just wanted to understand what's going on)
PS replacing the 'COALESCE' with ISNULL doesn't make much of a difference
Apr 28 '10 #1
6 2197
code green
1,726 Expert 1GB
Not sure but does this make a difference?
Expand|Select|Wrap|Line Numbers
  1. COALESCE(cash, 0.00) as vc_cash_current 
Apr 28 '10 #2
hilaDG
6
(and it played with isnull(), just to be sure that it doesn't matter...)
The reason I need this in the first place is that Access sees a Deciaml (38, 5) and reads it as text.
Apr 29 '10 #3
code green
1,726 Expert 1GB
I don't understand your reply but there is always CAST()
Apr 29 '10 #4
hilaDG
6
But if you know of anything in the database definitions that could cause this change, please let me know. Thanks for your help.
Apr 30 '10 #5
ck9663
2,878 Expert 2GB
Check the structure of the tables on the join. The COALESCE will grab the data type with the highest precedence.

Good Luck!!!

~~ CK
Apr 30 '10 #6
hilaDG
6
And nothing worked better then dear old cast.
I would still like to understand better the decimal date type multiplying rules. If there's any good article you'd like to share please post below. thank you all.
Jun 17 '10 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Peter Scheurer | last post by:
Hi, we found some strange behavior when operating with floats and round(). The following simplified statement reproduces the problem. select 6.56 - round(convert(float, 6.56), 2) from...
5
by: guy | last post by:
Can someone point me to page that gives a decision tree on deciding when to use float or double in a C# application including performance impacts of using one over the other. And when is decimal...
8
by: Rene | last post by:
The following code: float someFloat = 0; for(int x = 1; x <= 10; x++) { someFloat += .1F; Console.WriteLine(someFloat.ToString()); }
15
by: Kay Schluehr | last post by:
I wonder why this expression works: >>> decimal.Decimal("5.5")**1024 Decimal("1.353299876254915295189966576E+758") but this one causes an error 5.5**1024 Traceback (most recent call...
6
by: karthi | last post by:
hi, I need user defined function that converts string to float in c. since the library function atof and strtod occupies large space in my processor memory I can't use it in my code. regards,...
8
by: avsrk | last post by:
Hello Folks , General C data types question , more geared up towards embedded folks . I have a positive float quantity with a fractional part (one decimal point) which occupies 4 bytes ....
35
by: bala.pandu | last post by:
Hello Everyone, When i am assigning a float value and try to print the same, i found the value stored is not the exact value which i gave. int main() { float f1; printf("Enter a float value...
6
by: vlsidesign | last post by:
Newbie question: 0 converted to 0.0 for float variable? If I have the following code, float myTotal; myTotal = 0; will C automatically add a decimal point and at least one zero to the right...
17
by: D'Arcy J.M. Cain | last post by:
I'm not sure I follow this logic. Can someone explain why float and integer can be compared with each other and decimal can be compared to integer but decimal can't be compared to float? True...
6
by: Terry Reedy | last post by:
Gerhard Häring wrote: The new fractions module acts differently, which is to say, as most would want. True Traceback (most recent call last): File "<pyshell#20>", line 1, in <module> F(1.0)...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.