Moving from Access backend to SQL Server as be. Efficiency help needed -
i working on developing application company. beginning planning on having split db access front end, , storing end data on our shared server. however, after doing research realized storing data in end access db on shared drive isn’t best idea many reasons (vpn slow shared drive remote offices, access might not best millions of records, etc.). anyways, decided still use access front end, host data on our sql server.
i have couple questions storing data on our sql server. right when insert record this:
private sub addbutton_click() dim rstorun dao.recordset set rstorun = currentdb.openrecordset("select * torun") rstorun.addnew rstorun("memnum").value = memnumtextentry.value rstorun.update memnumtextentry.value = null end sub
it seems inefficient have use sql statement select * torun , make recordset, add recordset, , update it. if there millions of records in torun take forever run? more efficient use insert statement? if so, how do it? our program still young in development can make pretty substantial changes. nobody on team access or sql expert appreciated.
if you're working sql server, use ado. handles server access better dao.
if inserting data sql server table, insert
statement can have (in sql 2008) 1000 comma-separated values
groups. therefore need 1 insert
each 1000 records. can append additional inserts after first, , entire data transfer through 1 string:
insert torun (memnum) values ('abc'),('def'),...,('xyz'); insert torun (memnum) values ('abcd'),('efgh'),...,('wxyz'); ...
you can assemble in string, use ado connection.execute
work. faster multiple dao or ado .addnew
/.update
pairs. need remember requery recordset afterwards if need populated newly-inserted data.
Comments
Post a Comment