回复 37楼 吹水佬
先生我代码这样修改了下(先试验只是1列),但提示说数据类型不对
ACTIVATE SCREEN
CLEAR
CLOSE DATABASES
SET SAFETY OFF
CREATE CURSOR ta (bh I, 列1 n(4))
CREATE CURSOR tb (bh I, 列1 n(4))
FOR i=1 TO 9
INSERT INTO ta VALUES (i,"列"+TRANSFORM(i))
INSERT INTO tb VALUES (i,"列"+TRANSFORM(i))
ENDFOR
SELECT ta
INDEX on bh TAG ta_bh
RAND(-1)
SELECT tb
INDEX ON RAND() TAG tb_r
SET RELATION TO bh INTO "ta"
ran = INT((RECCOUNT("tb")-1)*RAND()+1)
? " 取 "+TRANSFORM(ran)+" 条记录"
i = 0
SCAN FOR i<ran
? bh,列1
i = i+1
SCATTER MEMVAR
SELECT ta
GATHER MEMVAR
ENDSCAN
SELECT * FROM ta
COPY
TO
替换结果记录表.dbf