Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
lewiska
Starting Member
1 Post |
Posted - 2002-12-17 : 09:19:49
|
| When I try to run the following command INSERT INTO Unmatched_Debits (File_Date, Cheque_Number, Amount)SELECT Txn_Date, Cheque_Number, AmountFROM Imported_TxnsWHERE ((SELECT Str(Cheque_Number & Amount) FROM Imported_Txns WHERE Txn_Date = '14/11/2002') NOT IN (SELECT Str(Cheque_Number & Amount) FROM Credits WHERE Status = 'Unpaid'))SQL Server tells me "Invalid operator for data type. Operator equals boolean AND, data type equals numeric."I've searched through Books Online to no avail. Is my SQL statement invalid? |
|
|
Nazim
A custom title
1408 Posts |
Posted - 2002-12-17 : 09:45:53
|
| if you are trying to concatenate cheque_number and amount .then you should use + instead of & .Try thisINSERT INTO Unmatched_Debits (File_Date, Cheque_Number, Amount) SELECT Txn_Date, Cheque_Number, Amount FROM Imported_Txns WHERE ( Txn_Date = '14/11/2002') and (Str(Cheque_Number) & str(Amount) )NOT IN (SELECT Str(Cheque_Number) & str(Amount) FROM Credits where status='Unpaid')-------------------------What lies behind you and what lies ahead of you are small matters compared to what lies within you.-Ralph Waldo EmersonEdited by - Nazim on 12/17/2002 09:46:48Edited by - Nazim on 12/17/2002 09:47:56 |
 |
|
|
ValterBorges
Master Smack Fu Yak Hacker
1429 Posts |
Posted - 2002-12-17 : 09:46:07
|
| Just a guess. If you provide DDL, Sample Data and some expected results we can be exact.INSERT INTO Unmatched_Debits (File_Date, Cheque_Number, Amount)SELECT A.Txn_Date, A.Cheque_Number, A.AmountFROM Imported_Txns A LEFT JOIN Credits B ON A.Cheque_Number = B.ChequeNumberWHERE A.Txn_Date = '14/11/2002' AND B.Status <> 'Unpaid' |
 |
|
|
|
|
|
|
|