Solved

Strange IBM DB2 error

Posted on 2013-06-09
4
2,951 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

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…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses

710 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