Q&A

  • 뷰생성시 에러입니다.
생성할 뷰의 내용입니다.
-- 거래처 마감 뷰
CREATE VIEW vFlowSum
AS
SELECT Drgst, Seq, ChkIO, CompSale, Company, GoodName, Norm, Unit,
       IsNull(CntFlow, 0) As cCntFlow,
       IsNull(Mcost, 0) As cMcost,
       IsNull(Msum, 0) As cMsum,
       IsNull(Mvat, 0) As cMvat,
       IsNull(Mtot, 0) As cMtot, CompName, ChkTax
  From tFlowGood
UNION
Select Dbase As Drgst, 0 As Seq, '기초', CompCode, CompName, '기초미수금', Null, Null, 0, 0, 0, 0, BaseMisu, Null, Null
  From tCodComp
Where IsNull(BaseMisu, 0) <> 0
UNION
Select Drgst, 0 As Seq, (Case When (ChkIO = '입고') or (ChkIO = '반입') then '전출' else case when (ChkIO = '출고') or (ChkIO = '반출')  then '전입' else case when (ChkIO = '입금') then '입금'  else case when (ChkIO = '출금') then '출금' else ChkIO end end),
        CompCode, CompName,
       (Case When Mcash > 0 then '현금 ' else '' end) + (Case When Mcard > 0 then '카드 ' else '' end) +
       (Case When Mnote > 0 then '어음 ' else '' end) + (Case When Metc > 0 then '기타 ' else '' end),
       Null, Null, 0, 0, 0, 0,
       (IsNull(Mcash, 0) + IsNull(Mcard, 0) + IsNull(Mnote, 0) + IsNull(Metc, 0)) As Mtot, EtcMemo, Null
  From tFlowMain
Where (ChkSave = 'T' or ChkSave = 'M') And (IsNull(Mcash, 0) + IsNull(Mcard, 0) + IsNull(Mnote, 0) + IsNull(Metc, 0)) <> 0

에러내용입니다.
Server: Msg 170, Level 15, State 1, Procedure vFlowSum, Line 15
Line 15: Incorrect syntax near ')'.

개발환경
WIN2000SEVER, MSSQL7, DELPHI5
1  COMMENTS
  • Profile
    이성찬 2002.02.27 02:41
    15라인 case 문에서 'else case when ~ then" 부분을 'when ~ then' 으로 바꾸시고 else 는 끝에 하나만 써보세요