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
- VIEW [dbo].[v_cash_sub] AS
- SELECT po_account,
- SUM(po_quantity ) as cash
- FROM dbo.position
- INNER JOIN dbo.security
- ON se_id = po_security
- WHERE se_cash <> 0
- GROUP BY po_account
I enquire in a different view:
Expand|Select|Wrap|Line Numbers
- CREATE VIEW [dbo].[v_cash_test] AS
- SELECT
- po_account as vc_account,
- COALESCE(cash, 0) as vc_cash_current
- FROM dbo.v_cash_sub
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