p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > SQL Server > SQL Server 2000 > SQL Server 2000
I forgot my password Register Now
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 28th, 2004, 11:45 AM
Friend of Wrox
Points: 1,272, Level: 14
Points: 1,272, Level: 14 Points: 1,272, Level: 14 Points: 1,272, Level: 14
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , .
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old January 28th, 2004, 12:27 PM
Authorized User
Points: 172, Level: 3
Points: 172, Level: 3 Points: 172, Level: 3 Points: 172, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2003
Location: Middletown, CT, USA.
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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #3 (permalink)  
Old January 28th, 2004, 12:36 PM
Friend of Wrox
Points: 2,591, Level: 21
Points: 2,591, Level: 21 Points: 2,591, Level: 21 Points: 2,591, Level: 21
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Hudson, MA, USA.
Posts: 839
Thanks: 0
Thanked 0 Times in 0 Posts
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #4 (permalink)  
Old January 28th, 2004, 12:42 PM
Friend of Wrox
Points: 2,591, Level: 21
Points: 2,591, Level: 21 Points: 2,591, Level: 21 Points: 2,591, Level: 21
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Hudson, MA, USA.
Posts: 839
Thanks: 0
Thanked 0 Times in 0 Posts
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

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 05:51 AM
Error Old Format or invalid type Libraiy bahraman VB.NET 2002/2003 Basics 0 July 17th, 2006 09:05 AM
Error Old Format or invalid type Libraiy bahraman VB.NET 2002/2003 Basics 0 July 17th, 2006 09:02 AM
java.sql.SQLException: Invalid column type Che Guevara Java Databases 1 July 1st, 2005 08:39 AM
Error message: old format or invalid type library kaz .NET Framework 2.0 2 October 6th, 2004 01:39 PM



All times are GMT -4. The time now is 08:25 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc