|
Subject:
|
Invalid operator for data type......
|
|
Posted By:
|
Adam H-W
|
Post Date:
|
1/28/2004 10:45:04 AM
|
Hi all
I was wondering if anyone can help me with this problem that I'm getting:
Invalid operator for data type. Operator equals multiply, type equals varchar.
I've changed both columns that I'm trying to multiply to data type int but it still shows me this error. This is my query:
SELECT iol.TransactionID, iol.Lite_Order_LineItems_Product, iol.Lite_Order_LineItems_Quantity, iol.Lite_Order_LineItems_Amount, SUM(iol.Lite_Order_LineItems_Quantity * imd.Lite_Order_Amount) AS 'Total' FROM Iveri_Manual_Details imd, Iveri_Order_LineItems iol WHERE iol.TransactionID = '26' GROUP BY iol.TransactionID, iol.Lite_Order_LineItems_Product, iol.Lite_Order_LineItems_Quantity, iol.Lite_Order_LineItems_Amount
many thanks
Adam
|
|
Reply By:
|
jrwlkn
|
Reply Date:
|
1/28/2004 11:27:52 AM
|
In your SUM function, try casting the quantity and amount fields using CDbl Or CInt
e.g. CDbl(iol.Lite_Order......
John
|
|
Reply By:
|
Jeff Mason
|
Reply Date:
|
1/28/2004 11:36:56 AM
|
quote: Originally posted by jrwlkn
In your SUM function, try casting the quantity and amount fields using CDbl Or CInt
e.g. CDbl(iol.Lite_Order......
John
Those functions do not exist in SQL Server...
Jeff Mason Custom Apps, Inc. www.custom-apps.com
|
|
Reply By:
|
Jeff Mason
|
Reply Date:
|
1/28/2004 11:42:49 AM
|
First off, you do realize that you are constructing a cartesian product of the two tables? There is no JOIN expression in your query, either explicitly or implicitly in the WHERE clause.
How did you "change both columns that [you're] trying to multiply to data type int"? If this conversion was indeed successful, there is no way you should get that error.
My suspicion is that the conversion never did actually occur, and that you have some invalid numeric character data in those columns (like maybe spaces?)
Jeff Mason Custom Apps, Inc. www.custom-apps.com
|