By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,924 Members | 1,793 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,924 IT Pros & Developers. It's quick & easy.

file versus command line issue

P: n/a
Group,

I'm learning DB2 as part of my internship and I've run into a really
weird problem. If I run a script as a file using the following command:

db2 -n -td@ -f audit.db2 +o -x -z audit.cvs

it works. However if I copy and paste that same sql that is in the .db2
file:

db2 -n -td@ SELECT CREATED, EVENT, PROCESS_ID from fmc.audit where
created > timestamp('2005-06-09-21.31.57.520925') for read only@ +o -x
-z audit.cvs I get the following error:

SQL0104N An unexpected token "for" was found following "_trail where
created". Expected tokens may include: "<interval_qualifier>".
SQLSTATE=42601

Any help would be greatly appreciated as I'm still learning a lot about
DB2. Also, I'm using version 8.1.0.36 and the database is on a Solaris
backend, but I'm working through Windows and the dbcmd prompt.

Melih Onvural

Nov 12 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
If this happens to anyone else I wanted to write out a solution.

the greater than and less than signs are interpreted as redirection on
the command prompt so you have to make sure to let the system know that
this is one long sql command by putting it in quotes (" ")

Nov 12 '05 #2

P: n/a
In article <11**********************@g49g2000cwa.googlegroups .com>,
(me***********@gmail.com) says...
db2 -n -td@ SELECT CREATED, EVENT, PROCESS_ID from fmc.audit where
created > timestamp('2005-06-09-21.31.57.520925') for read only@ +o -x
-z audit.cvs I get the following error:


I'm not sure if this fixes all issues but it might be worth a try:

db2 -n "SELECT CREATED, EVENT, PROCESS_ID from fmc.audit where
created > timestamp('2005-06-09-21.31.57.520925') for read only" +o
-x -z audit.cvs
Nov 12 '05 #3

P: n/a
If this happens to anyone else I wanted to write out a solution.

the greater than and less than signs are interpreted as redirection on
the command prompt so you have to make sure to let the system know that
this is one long sql command by putting it in quotes (" ")

Nov 12 '05 #4

P: n/a
How about :
db2 -n -td@ +o -x -z audit.cvs "SELECT CREATED, EVENT, PROCESS_ID from
fmc.audit where created > timestamp('2005-06-09-21.31.57.520925') for
read only@ "

Thanks
Rahul.

Nov 12 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.