Solved

Strange IBM DB2 error

Posted on 2013-06-09
4
2,780 Views
Last Modified: 2013-06-09
I tried to execute this sql command

SELECT * from db2inst1.users where username = 'esmith'

However, I got the following message:
1) [Error Code: -206, SQL State: 42703]  DB2 SQL Error: SQLCODE=-206, SQLSTATE=42703, SQLERRMC=USERNAME, DRIVER=4.13.127. 2) [Error Code: -727, SQL State: 56098]  DB2 SQL Error: SQLCODE=-727, SQLSTATE=56098, SQLERRMC=2;-206;42703;USERNAME, DRIVER=4.13.127

I have verified the column 'username' exist in the table and if I executed:

SELECT * from db2inst1.users

It executes successfully

Attach is the screen shot of the result

Any help is greatly appreciated
2013-06-09-06-25-13.png
0
Comment
Question by:widj91942
  • 2
4 Comments
 
LVL 37

Accepted Solution

by:
momi_sabag earned 500 total points
ID: 39232988
it is weird
have you tried

SELECT * from db2inst1.users where "UserName" = 'esmith'
0
 

Author Closing Comment

by:widj91942
ID: 39233006
I believed I have tried that, however, I think the capitalization is different. This is weird, normally the column name is not case-sensitive.

Anyhow, thanks a lot.
0
 
LVL 45

Expert Comment

by:Kent Olsen
ID: 39233103
Hi widj91942,

Just elaborating...

Column names, just like ALL names in the database, are case sensitive.  The name in the query is converted to upper case unless it is enclosed in quotes.  The four statements below are equivalent.  They all create the table XX (upper case) with one column, USERNAME (upper case).

CREATE TABLE xx (USERNAME varchar (100));
CREATE TABLE xx (UserName varchar (100));
CREATE TABLE xx (username varchar (100));
CREATE TABLE xx ("USERNAME" varchar (100));

The statements below create a table identical to the table created above, except that the table and column name are create with the exact upper/lower case as is in the quotes.

CREATE TABLE "xx" ("username" varchar (100));
CREATE TABLE "Xx" ("Username" varchar (100));
CREATE TABLE "xX" ("UserName" varchar (100));

Good Luck,
Kent
0
 

Author Comment

by:widj91942
ID: 39233118
Thanks a lot for the elaboration.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Recursive SQL in UDB/LUW (you can use 'recursive' and 'SQL' in the same sentence) A growing number of database queries lend themselves to recursive solutions.  It's not always easy to spot when recursion is called for, especially for people una…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This video teaches viewers about errors in exception handling.

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question