Hello,
I am trying to truncate a table using the DB2 import command (importing an emprty file into the table)
The command works fine at the Command Center and Db2 prompt.
But when I try to run it as a "before SQL" statement I get this error :
[IBM][CLI Driver][DB2/AIX64] SQL0104N An unexpected token "from" was found following "import ". Expected tokens may include: "JOIN <joined_table>". SQLSTATE=42601
Executing SQL statement 'import from empty of del replace into <tablename>'
Anyone else encountered this problem ?
Actually my table has more than 40 million rows - so I dont want to do a delete from on it but use this command instead.
Any inputs are appreciated.
Thanks
-Xan
Db2 Import command as before SQL
Moderators: chulett, rschirm, roy
-
- Charter Member
- Posts: 13
- Joined: Tue Apr 08, 2003 9:51 pm
- Location: Australia
Hi,
We also tried to use but could not accomplish in the before Sql.
So we used Before routine to do the truncation
paste following code in job before routine and substitute according to yours
Eg:
db2 "connect to <databasename>";db2 "export to '<filepath>' of ixf select * from <tablename> where 1=2" ;db2 "import from '<filepath>' of ixf replace into <tablename>"
-Chandru
We also tried to use but could not accomplish in the before Sql.
So we used Before routine to do the truncation
paste following code in job before routine and substitute according to yours
Eg:
db2 "connect to <databasename>";db2 "export to '<filepath>' of ixf select * from <tablename> where 1=2" ;db2 "import from '<filepath>' of ixf replace into <tablename>"
-Chandru
Thanks for your response Chandru.
But I get this error when I try doing that :
db2 "connect to <databasename>";
"String Constant unexpected, Was expecting: Assignment Operator"
I am positive that I am doing some trivial error and missing something - but not able to figure out what.
Anyways thanks for letting me know
-Xan
But I get this error when I try doing that :
db2 "connect to <databasename>";
"String Constant unexpected, Was expecting: Assignment Operator"
I am positive that I am doing some trivial error and missing something - but not able to figure out what.
Anyways thanks for letting me know
-Xan
The before job routine...is that a basic routine or do you past the above code right into the code line?s_r_chandru wrote:Hi,
We also tried to use but could not accomplish in the before Sql.
So we used Before routine to do the truncation
paste following code in job before routine and substitute according to yours
Eg:
db2 "connect to <databasename>";db2 "export to '<filepath>' of ixf select * from <tablename> where 1=2" ;db2 "import from '<filepath>' of ixf replace into <tablename>"
-Chandru
Jim
Sure I need help....But who dosent?