Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.
Moderators: chulett, rschirm, roy
-
aaikat
- Participant
- Posts: 47
- Joined: Tue Mar 07, 2006 2:49 am
Post
by aaikat »
Can I do the following(dynamic building of SQL query) in a server job :
I am using a DB2 UDB stage. In it output custom SQL I write :
#SQL_STATEMENT#
Then define the parameter SQL_STATEMENT as
Select count(*) as all from ABC.X_CONTACTS where XID = 'RVH'
Now when I run the job I get error like :
An unexpected token "<<missing table>>" was found following "SELECT all FROM ". Expected tokens may include: "<space>". SQLSTATE=42601
SQLExecDirect: Error executing statement 'SELECT all FROM <<missing table>>'. See following DB2 message for details.
-
kumar_s
- Charter Member
- Posts: 5245
- Joined: Thu Jun 16, 2005 11:00 pm
Post
by kumar_s »
Is "count(*) as" and the table name alone given as parameter?
If so check whether the parameter is getting passed properly.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
-
sb_akarmarkar
- Participant
- Posts: 232
- Joined: Fri Sep 30, 2005 4:52 am
-
Contact:
Post
by sb_akarmarkar »
I think 'all' is a reserve keyword you are trying to assign to count(*)...
Please try some other name like
Select count(*) as A from ABC.X_CONTACTS where XID = 'RVH'
Thanks,
Anupam
-
DSguru2B
- Charter Member
- Posts: 6854
- Joined: Wed Feb 09, 2005 3:44 pm
- Location: Houston, TX
Post
by DSguru2B »
If it is a reserved word, use it in double quotes. You should be fine then.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
-
chulett
- Charter Member
- Posts: 43085
- Joined: Tue Nov 12, 2002 4:34 pm
- Location: Denver, CO
Post
by chulett »
OR just get rid of it, the 'as XXX' part is completely ignored.
-craig
"You can never have too many knives" -- Logan Nine Fingers