Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3541
  • Last Modified:

Strange IBM DB2 error

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
widj91942
Asked:
widj91942
  • 2
1 Solution
 
momi_sabagCommented:
it is weird
have you tried

SELECT * from db2inst1.users where "UserName" = 'esmith'
0
 
widj91942Author Commented:
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
 
Kent OlsenData Warehouse Architect / DBACommented:
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
 
widj91942Author Commented:
Thanks a lot for the elaboration.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now