Solved

Strange IBM DB2 error

Posted on 2013-06-09
4
2,668 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:Kdo
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
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:
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

770 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