我有一个500,000行的sql脚本.
update users set region_id = 9814746 where id = 101 and region_id is null;
update users set region_id = 9814731 where id = 102 and region_id is null;
update users set region_id = 3470676 where id = 103 and region_id is null;
...
....
Run Code Online (Sandbox Code Playgroud)
我需要能够生成一个脚本,每50行开始...提交.我该怎么做呢?我将在pg-admin中运行它.
谢谢,沙拉多夫
这可能是一个好的开始:
cat sql.file | perl -e 'i=0;print "begin;\n"; while(<>){print;i++;if(i % 50 == 0){print "end;\nbegin;\n";}}print "end\n";' > outputsql.file
| 归档时间: |
|
| 查看次数: |
1000 次 |
| 最近记录: |