I run the next stored priority. The result set is bound to the gridView control.
@EmbossLine varchar(20),
@TransactionTypeID int,
@DateFrom datetime,
@DateTo datetime
AS
Select
pt.TransactionDate,
m.MerchantName1,
pt.TerminalID,
pt.SequenceNumber,
tt.TransactionType,
case TT.TransactionTypeID when 0 then PT.TotalAmount else 'null' end 'PointsEarned',
case TT.TransactionTypeID when 2 then PT.TotalAmount else 'null' end 'PointsRedemeed'
from POS_Transactions PT
inner join TransactionType TT on TT.TransactionTypeID = PT.TransactionTypeID
inner join CardBalance CB on CB.PAN = PT.PAN
inner join Terminal T on T.TerminalID = PT.TerminalID
inner join Merchant M on M.MerchantID = T.MerchantID
where
(PT.TransactionDate>=@DateFrom and PT.TransactionDate<=@DateTo)
and (PT.TransactionTypeID = @TransactionTypeID or @TransactionTypeID ='-999')
and(PT.PAN=@EmbossLine or PT.PAN='-999')
order by PT.TransactionDate desc
Actually, what I'm trying to do, I want to print nullwhen mine is TransactionTypeIDnot equal to 0or 2. but it throws a runtime exception
Cannot convert a char value to money. The char value has incorrect syntax.
I know this is a conversion problem and you want to know how I can print some value when my conditions evaluate to false
source
share