P
Pc 狂迷
Unregistered / Unconfirmed
GUEST, unregistred user!
有个表原有15万行数据,没设主键,现想为每条记录按顺序加一个 ID ,可下面语句太太太
慢了,4000条都用了十几分钟。所以希望能用 SQL 语句加速。以下能否用一句 SQL 实现?
var
i : Integer ;
begin
i := 0;
ADOTable1.Active := True;
adotable1.first;
while not ADOTable1.Eof do
begin
Inc(i);
adotable1.edit;
ADOTable1.FieldByName('id').AsInteger := i;
ADOTable1.Next;
end;//while
ADOTable1.post;
end;
慢了,4000条都用了十几分钟。所以希望能用 SQL 语句加速。以下能否用一句 SQL 实现?
var
i : Integer ;
begin
i := 0;
ADOTable1.Active := True;
adotable1.first;
while not ADOTable1.Eof do
begin
Inc(i);
adotable1.edit;
ADOTable1.FieldByName('id').AsInteger := i;
ADOTable1.Next;
end;//while
ADOTable1.post;
end;