473,387 Members | 1,492 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Query's Strange Behavior

Greetings,
Now this query is making me crazy. Working on it for almost 2 hrs
but no output

Query:

SELECT ACTIONEMAILTRANSID \
,ITEMTRANSID \
,COMPANYID \
,UPDATEDDATE \
,UPDATEDBY \
,DELETEFLAG \
FROM schema.tablename

The above query is generating dynamically in a script and submitted to
db2
But its giving the following error

SQL0206N "ACTIONEMAILTRANSID" is not valid in the context where it is
used.
SQLSTATE=42703

If I remove ACTIONEMAILTRANSID column and try again it works fine.

Also if I do a
select *
from schema.tablename
it works fine.

Moreover if I give just

select ACTIONEMAILTRANSID
from schema.tablename

it fails.

What is wrong here?

schema.tablename structure:

Column Type Type
name schema name Length
Scale Nulls
------------------------------ --------- ------------------ --------
----- ------
ActionEmailTransId SYSIBM INTEGER
4 0 No
ITEMTRANSID SYSIBM INTEGER
4 0 No
COMPANYID SYSIBM INTEGER
4 0 No
UPDATEDDATE SYSIBM TIMESTAMP
10 0 No
UPDATEDBY SYSIBM VARCHAR
128 0 No
DELETEFLAG SYSIBM CHARACTER
1 0 No

DB Version:

Database server = DB2/6000 8.2.2

Any help would be appreciated

TIA

Jun 27 '07 #1
2 1570
pa***************@yahoo.co.in wrote:
Greetings,
Now this query is making me crazy. Working on it for almost 2 hrs
but no output

Query:

SELECT ACTIONEMAILTRANSID \
,ITEMTRANSID \
,COMPANYID \
,UPDATEDDATE \
,UPDATEDBY \
,DELETEFLAG \
FROM schema.tablename

The above query is generating dynamically in a script and submitted to
db2
But its giving the following error

SQL0206N "ACTIONEMAILTRANSID" is not valid in the context where it is
used.
SQLSTATE=42703

If I remove ACTIONEMAILTRANSID column and try again it works fine.

Also if I do a
select *
from schema.tablename
it works fine.

Moreover if I give just

select ACTIONEMAILTRANSID
from schema.tablename

it fails.

What is wrong here?

schema.tablename structure:

Column Type Type
name schema name Length
Scale Nulls
------------------------------ --------- ------------------ --------
----- ------
ActionEmailTransId SYSIBM INTEGER
4 0 No
ITEMTRANSID SYSIBM INTEGER
4 0 No
COMPANYID SYSIBM INTEGER
4 0 No
UPDATEDDATE SYSIBM TIMESTAMP
10 0 No
UPDATEDBY SYSIBM VARCHAR
128 0 No
DELETEFLAG SYSIBM CHARACTER
1 0 No

DB Version:

Database server = DB2/6000 8.2.2

Any help would be appreciated

TIA
I think the problem is that you have forced db2 to store the name of
ActionEmailTransId in mixed case in the catalog. You can do that by
using " around your column during creation, i.e. (not recomended)

[lelle@53dbd181 lelle]$ db2 "create table test ( \"MixedCaseColumn\"
int, UppercaseColumn int)"

[lelle@53dbd181 lelle]$ db2 "select colname from syscat.columns where
tabname = 'TEST'"

COLNAME

--------------------------------------------------------------------------------------------------------------------------------
MixedCaseColumn

UPPERCASECOLUMN
Since the colname is in lowercase in the catalog you will have to
continue using that. Try:

SELECT "ActionEmailTransId" \
,ITEMTRANSID \
,COMPANYID \
,UPDATEDDATE \
,UPDATEDBY \
,DELETEFLAG \
FROM schema.tablename

and see how that goes. Note that:

SELECT ActionEmailTransId \
,ITEMTRANSID \
,COMPANYID \
,UPDATEDDATE \
,UPDATEDBY \
,DELETEFLAG \
FROM schema.tablename

wont work because db2 will transform it to uppercase.
HTH
/Lennart
Jun 27 '07 #2
On Jun 27, 9:08 pm, Lennart <erik.lennart.jons...@gmail.comwrote:
pankaj_wolfhun...@yahoo.co.in wrote:
Greetings,
Now this query is making me crazy. Working on it for almost 2 hrs
but no output
Query:
SELECT ACTIONEMAILTRANSID \
,ITEMTRANSID \
,COMPANYID \
,UPDATEDDATE \
,UPDATEDBY \
,DELETEFLAG \
FROM schema.tablename
The above query is generating dynamically in a script and submitted to
db2
But its giving the following error
SQL0206N "ACTIONEMAILTRANSID" is not valid in the context where it is
used.
SQLSTATE=42703
If I remove ACTIONEMAILTRANSID column and try again it works fine.
Also if I do a
select *
from schema.tablename
it works fine.
Moreover if I give just
select ACTIONEMAILTRANSID
from schema.tablename
it fails.
What is wrong here?
schema.tablename structure:
Column Type Type
name schema name Length
Scale Nulls
------------------------------ --------- ------------------ --------
----- ------
ActionEmailTransId SYSIBM INTEGER
4 0 No
ITEMTRANSID SYSIBM INTEGER
4 0 No
COMPANYID SYSIBM INTEGER
4 0 No
UPDATEDDATE SYSIBM TIMESTAMP
10 0 No
UPDATEDBY SYSIBM VARCHAR
128 0 No
DELETEFLAG SYSIBM CHARACTER
1 0 No
DB Version:
Database server = DB2/6000 8.2.2
Any help would be appreciated
TIA

I think the problem is that you have forced db2 to store the name of
ActionEmailTransId in mixed case in the catalog. You can do that by
using " around your column during creation, i.e. (not recomended)

[lelle@53dbd181 lelle]$ db2 "create table test ( \"MixedCaseColumn\"
int, UppercaseColumn int)"

[lelle@53dbd181 lelle]$ db2 "select colname from syscat.columns where
tabname = 'TEST'"

COLNAME

---------------------------------------------------------------------------*-----------------------------------------------------
MixedCaseColumn

UPPERCASECOLUMN

Since the colname is in lowercase in the catalog you will have to
continue using that. Try:

SELECT "ActionEmailTransId" \
,ITEMTRANSID \
,COMPANYID \
,UPDATEDDATE \
,UPDATEDBY \
,DELETEFLAG \
FROM schema.tablename

and see how that goes. Note that:

SELECT ActionEmailTransId \
,ITEMTRANSID \
,COMPANYID \
,UPDATEDDATE \
,UPDATEDBY \
,DELETEFLAG \
FROM schema.tablename

wont work because db2 will transform it to uppercase.

HTH
/Lennart- Hide quoted text -

- Show quoted text -
Thanks a zillion Lennart.
It was eating my head from a long time. Actually still learning.
Thanks again.

Jun 27 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Rik Moed | last post by:
Hi, I have a question about a query which I want to share with you. Maybe someone knows how this strange behavior occurs. Here is what I do: SELECT top 1 actstage FROM v_OpportunityFase...
39
by: Chetan Raj | last post by:
Hi All, One of my friend asked this question on C++ >>> Hi, Can u give an answer to this : We have the .h files for standard library. Consider any class (such as
8
by: Evan Smith | last post by:
During a routine performance check using an event monitor, I discovered a class of query whose performance has me baffled. The monitor captured: SELECT * FROM EWM_CASE fetch first 1 rows only...
0
by: Ellen Ricca | last post by:
I have an Access db with several ODBC linked ORACLE tables. These tables have multiple-field PK's. The tables work just fine in many diff types of queries including unmatched queries that are...
0
by: salimshahzad | last post by:
dear respected sir, i have so much strange behavior of access queries using through VBA codes here is the structure of tables - tblMaster(where PK is PolicNo) - tblDetails so there is...
0
by: Hans Kesting | last post by:
When I create a new UriBuilder and read the value if the Query property, then the query is returned including leading '?'. Not quite what I expected, but I can live with it (and it is documented)...
6
by: Joseph Geretz | last post by:
Writing an Outlook AddIn with C#. For the user interface within Outlook I'm adding matching pairs of Toolbar buttons and Menu items. All of the buttons and menu items are wired up to send events to...
7
by: bryant | last post by:
Hi all. I am new to ASP and working in Expression Web. The following query displays the information I need in the gridview for a single record. SELECT "OE_HDR"."ORD_NO", "OE_HDR"."CUST_NAM",...
0
by: KC-Mass | last post by:
Hi I looked at some tables for someone today who was wondering if the SiteID in each of the product and other tables was in the SiteName table. I used some quick queries that all looked about...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.