|
|
 |
| SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the SQL Server 2000 section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
|
 |

January 28th, 2004, 11:45 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Location: , , .
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Invalid operator for data type......
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
|

January 28th, 2004, 12:27 PM
|
|
Authorized User
|
|
Join Date: Dec 2003
Location: Middletown, CT, USA.
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
In your SUM function, try casting the quantity and amount fields using CDbl Or CInt
e.g. CDbl(iol.Lite_Order......
John
|

January 28th, 2004, 12:36 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Location: Hudson, MA, USA.
Posts: 839
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
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
|

January 28th, 2004, 12:42 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Location: Hudson, MA, USA.
Posts: 839
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |