Thanks to both Wikser and Trey as I had some syntax problem that was bring into my notice by them and after that my query still had problem.
Issue was- Net was an alias to my column and when i was checking it in case statement it was not able to find out the same column.
ERROR
select vd.LedgerId,(CreditAmt-DebitAmt) AS NET,
CASE
WHEN NET > 0 THEN 'Debit'
WHEN NET < 0 THEN 'Credit'
ELSE 'Nil'
End
AS NetVal
from dbo.vdebit vd INNER JOIN dbo.vCredit vc ON vd.LedgerId=vc.LedgerId
Correction Made
select vd.LedgerId,(CreditAmt-DebitAmt) AS NET,
CASE
WHEN (CreditAmt-DebitAmt) > 0 THEN 'Debit'
WHEN (CreditAmt-DebitAmt) < 0 THEN 'Credit'
ELSE 'Nil'
End
AS NetVal
from dbo.vdebit vd INNER JOIN dbo.vCredit vc ON vd.LedgerId=vc.LedgerId