Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie with Comparison operator = operands not compatible problem

Status
Not open for further replies.

iceman42

Programmer
Jan 30, 2006
25
0
0
US
I've googled and searched other areas for the answers and cant seem to find a good answer for my problem. I have a select query very straight forward, very simple.

SELECT * FROM CUSTMAST WHERE "CUST#" = 001234. What I keep getting back is [IBM][iSeries Access ODBC Driver][DB2 UDB]SQL0401 - Comparison operator = operands not compatible.

I can query for first 10 or do select all, but can't query for a particular record.

Any thoughts?
 
What is the datatype of Cust #? If it is a char or varchar then you would need single quotes around 001234.

SELECT * FROM CUSTMAST WHERE "CUST#" = '001234'
 
Hi iceman42,
By putting cust# in quotes, db2 s treating it as a literal and is then comparing a literal to a number and getting confused. If your column on the table is called cust# then just remove the qoutes and it should work OK.

Hope this helps

Marc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top