求DB2中删除一个大表的所有记录的做法- DB2

来源:百度文库 编辑:神马文学网 时间:2024/04/29 19:40:53
求DB2中删除一个大表的所有记录的做法

请问大家一个问题:
    我在网上看到关于在DB2中删除一个很大的表的所有记录的做法是这样的:
在建立该表时带NOT LOGGED INITIALLY参数,并在删除时用语句:alter table [name] activate not logged initially with empty table。但我在建立表时带上NOT LOGGED INITIALLY时总是提示语法出错!比如我建表的语句是这样的:
create table test( aa char(2) ) not logged initially。
   请大家指出错在哪里在?正确的应该怎么写?
求DB2中删除一个大表的所有记录的做法

你的语法是正确的!
出什么提示,贴出来看看!

还有一个删除大表的办法 :
1、导出空文件:
export to empty.ixf of ixf select * from YOURtbl where 1=2
2、导入空文件:
import from empty.ixf of ixf replace into YOURtbl

很快!
求DB2中删除一个大表的所有记录的做法

mymm,不行啊,报错!以下是报的错误(我的表名是test1,有记录)

db2 =>; export to empty .ixf of ixf select * from test1 where 1=2
SQL0104N  在 "<标识符>;" 之后发现意外的记号 ".ixf"。期望的记号可能包括:"OF"。
SQLSTATE=42601
db2 =>;
db2 =>;

这是为什么啊!
求DB2中删除一个大表的所有记录的做法

export to empty .ixf of ixf select * from test1 where 1=2
    在empty 和.ixf 之间不要有空格
求DB2中删除一个大表的所有记录的做法

>; create table test( aa char(2) ) not logged initially

错误信息如下:

[SQL0199] Keyword NOT not expected. Valid tokens: ;. Cause . . . . . :   The keyword NOT was not expected here.  A syntax error was detected at keyword NOT.  The partial list of valid tokens is ;. This list assumes that the statement is correct up to the unexpected keyword.  The error may be earlier in the statement but the syntax of the statement seems to be valid up to this point. Recovery  . . . :   Examine the SQL statement in the area of the specified keyword.  A colon or SQL delimiter may be missing. SQL requires reserved words to be delimited when they are used as a name. Correct the SQL statement and try the request again.
求DB2中删除一个大表的所有记录的做法

在unix下也可以用一下命名行:
  import from /dev/null  of del replace into tabname
求DB2中删除一个大表的所有记录的做法

我是想在程序中实现删除的功能,所以用命令的形式好像是不行的。我的程序是连到AS400服务器上的DB2的,我查过关于在AS400上运行的SQL语句,CREATE TABLE语句中确实没有NOT LOGGED INITIALLY选项,所以这个方法看来是行不通了!
      大家想想还有没有其它的办法啊!
求DB2中删除一个大表的所有记录的做法

可以通过系统调用来进行执行。
求DB2中删除一个大表的所有记录的做法

你可以通过API编程搞定!
求DB2中删除一个大表的所有记录的做法

谢谢大家的指点!
我去试试看!
大家如果还有什么别的方法,请再指教!
求DB2中删除一个大表的所有记录的做法

export方法不能清空一个表,只能用import方法
求DB2中删除一个大表的所有记录的做法

1 倒出表结构
EXPORT TO C:\TABLE.IXF OF IXF SELECT *FROM TABLE WHERE 1=2
2 清除表
DROP TABLE TABLENAME
3 导入空表
IMPORT FROM C:\TABLE.IXF OF IXF CREATE INTO TABLENAME
求DB2中删除一个大表的所有记录的做法

用DROP TABEL我觉得不太好!
因为如果刚好有人在用那个表的话就会错!