sql server的回滚需要占用什么资源呢?怎样可以进行监控,怎么设置回滚段的大小?还有在sql server 里插大入大量的数据时(几百万条,甚至更多)我做过试验,从一个dbf数据库读1万条数据,对某些字段修改后,再写入sql server时,
如果用ADO,读一条记录,再Addnew,update,插入所有记录用时25秒,
如果写一存储过程,用insert语句,最后Commtrans提交事务的方式,用时15秒我想问的时,在VB里面,插入大量数据时,用什么方式最快,有什么好的方式?
如果用ADO,读一条记录,再Addnew,update,插入所有记录用时25秒,
如果写一存储过程,用insert语句,最后Commtrans提交事务的方式,用时15秒我想问的时,在VB里面,插入大量数据时,用什么方式最快,有什么好的方式?
cn.execute "insert into table values...."
sql="insert into table values(field1,field2....) select (field1,field2....) from table2 where....."
不过,我想如果用文件导入导出的方法应该更快些,没有做过。
用insert into操作,需不需要commtrans,如果需要,是放在最后,还是每insert into一次,就Commtrans?
sql server的回滚需要占用什么资源呢?怎样可以进行监控,怎么设置回滚段的大小?
cn.execute tsql
后就提交事务。
on error goto err_comman1
conn.begintrans '开启事务
conn.execute "insert into tablename(...) values(...)" '插入数据
conn.execute "update tablename set ... where ..." '修改数据
conn.execute "delete from tablename where ..." '删除数据
'如果为删除表中所有记录,则可用conn.execute "truncate table tablename"
conn.committrans '提交事务
exit sub
err_comman1:
conn.rollbacktrans '操作出错回滚事务
msgbox "操作错误,错误原因为:" err.description,48,"提示"
exit sub
end sub