Pergunta

so i have this wierd question.. as fare as i know, the database server got a validation process to only commit new data, when the data is all stored.

now my question is, can i run multiply sql queries, and delay the commit, until all queries have been run?

i got 600.000 new entries, i want to split into smaller sql "insert into" queries, so i don't have to start all over, if the SQL query fails.

so is there a way to do following

"DELAY COMMIT"
"INSERT INTO ...."
"INSERT INTO ...."
"INSERT INTO ...."
"INSERT INTO ...."
...
...
...
"INSERT INTO ...."
"COMMIT"
Foi útil?

Solução

yes, use begin and commit transaction:

BEGIN TRANSACTION
INSERT INTO ...
INSERT INTO ...
INSERT INTO ...
INSERT INTO ...
INSERT INTO ...
COMMIT TRANSACTION
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top