i m developing an application in vb 6 and sql server 7
i want to copy some records from Voucher table to another table-AcCashBook. i used insert and select query but i want to use iff condition in select statement
plz help me in building this query
StrSQL = "Insert Into AcCashBook(Transactionid,LedgerName,Trans_date,Particulars,VoucherType,VoucherNo,ReceiptAmt,PaymentAmt,Narration) "
StrSQL = StrSQL & "Select Transactionid,'" & strAccountName & "',VoucherDate,AccountName,VoucherType,VoucherNo,iif(Debit<>0,0,Debit),iif(Credit<>0,0,Credit),Narration From Voucher,Accountcode"
StrSQL = StrSQL & "where LedgerName<>" & AccCode & " and VoucherNo in (select VoucherNo from voucher where LedgerName=" & AccCode & ") group by TransactionId,VoucherDate,AccountName,VoucherType,VoucherNo,Debit,Credit,Narration
i want to copy some records from Voucher table to another table-AcCashBook. i used insert and select query but i want to use iff condition in select statement
plz help me in building this query
StrSQL = "Insert Into AcCashBook(Transactionid,LedgerName,Trans_date,Particulars,VoucherType,VoucherNo,ReceiptAmt,PaymentAmt,Narration) "
StrSQL = StrSQL & "Select Transactionid,'" & strAccountName & "',VoucherDate,AccountName,VoucherType,VoucherNo,iif(Debit<>0,0,Debit),iif(Credit<>0,0,Credit),Narration From Voucher,Accountcode"
StrSQL = StrSQL & "where LedgerName<>" & AccCode & " and VoucherNo in (select VoucherNo from voucher where LedgerName=" & AccCode & ") group by TransactionId,VoucherDate,AccountName,VoucherType,VoucherNo,Debit,Credit,Narration