Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Urgent - Null Value not getting filled with 0

Status
Not open for further replies.

ashark

Programmer
Nov 21, 2002
31
0
0
IN
Hi Group,
I have a very strange problem.
I have a table and have built Views on that Table.
I have built a view which fills the value 1 into a Column which is Grouped by OrderNumber and Position Number.

I hve built another view on the top of this view which is Grouped by Order Number, Position Number and Sequence Number. When I insert Values into this view , I get followint Result :

OrderNo PositionNo SequenceNo NoOrderLines
100 10 0 1
100 20 1 NULL
100 30 2 NULL

When I try to fill in the NULL values by 0 by using the condition IsNull(NoOrderLines, 0) then it doesn't get filled by 0. Instead it gets filled by 1.

I have a another column in which I fill the Null vales by 0 in teh similar fashion and I get correct results there.

Can anyone please help me as to what the problem might be with this column???

Regards,
ashark
 
Can you show us the statement, a raw dump of the columns without the use of ISNULL(..) and with the use of ISNULL(...) please.
 
Also, is there a trigger on the table that might be causing the change from 0 to 1?

-SQLBill
 
Hi Group,
This the First Query where I fill values and Grouping is at Order and Position Level.

....
....
CASE WHEN max(OrderLineConfirmationDate) < min(OrderDate) THEN
0
ELSE
1
END AS OrderLineConfirmedFlag,
1 AS NoOrderLines
FROM DW_PUR_HISTORY
GROUP BY OrderNumber, PositionNumber


Here is the Query where I change NULL values to 0

select
V1.OrderDatePrefix, V1.OrderNumber, V1.PositionNumber, V1.SequenceNumber,

isnull(V2.OrderLineConfirmedFlag,0) as OrderLineConfirmedFlag,

FROM PUR_ALL3 AS V1 LEFT OUTER JOIN PUR_GET_LINE_DATA AS V2 ON
V1.OrderDatePrefix = V2.OrderDatePrefix AND
V1.OrderNumber = V2.OrderNumber AND
V1.PositionNumber = V2.PositionNumber AND
V1.SequenceNumber = 0 AND
V1.LogComp = V2.LogComp
WHERE (V1.OrderNumber = 'POR000123')


Can you makeout anything form this Query???

Regards,
ashark

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top