Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
|
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 Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 28th, 2004, 11:45 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Adam H-W
Default 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
 
Old January 28th, 2004, 12:27 PM
Authorized User
 
Join Date: Dec 2003
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
Default

In your SUM function, try casting the quantity and amount fields using CDbl Or CInt

e.g. CDbl(iol.Lite_Order......

John

 
Old January 28th, 2004, 12:36 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 839
Thanks: 0
Thanked 1 Time in 1 Post
Default

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
 
Old January 28th, 2004, 12:42 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 839
Thanks: 0
Thanked 1 Time in 1 Post
Default

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





Similar Threads
Thread Thread Starter Forum Replies Last Post
Invalid operator for data type. Operator equals di Pusstiu SQL Server 2000 2 August 10th, 2007 04:51 AM
Error Old Format or invalid type Libraiy bahraman VB.NET 2002/2003 Basics 0 July 17th, 2006 08:05 AM
Error Old Format or invalid type Libraiy bahraman VB.NET 2002/2003 Basics 0 July 17th, 2006 08:02 AM
java.sql.SQLException: Invalid column type Che Guevara Java Databases 1 July 1st, 2005 07:39 AM
Error message: old format or invalid type library kaz .NET Framework 2.0 2 October 6th, 2004 12:39 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.