• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 376
  • Last Modified:

Commit a SQL Server connection update

I use this code to update a sql server table MS Access VBA 2003 code:

    strSQLDelete = "DELETE FROM dbo.tbl_PS_DiscrepanciesLevel123Tmp"
    Set conn = New ADODB.Connection
    conn.Open g_str_BSQLP01VW_HostMR_Connect (this a string constant)
    conn.Execute strSQLDelete

It works fine. Is there a way to make sure the update is committed, or does that require using a stored procedure
1 Solution
That will work without needing a commit to delete the entire table. If you only want to delete some of the rows you need a WHERE clause on there.

Deleting all the rows in a table can also be done (faster) with TRUNCATE table_name unless there is a permission reason why the credentials running the command does not have TRUNCATE permission (a common situation).

Deleting all the rows with DELETE can generate a huge transaction log if the table has millions of rows.

If that delete does not work then either a trigger is preventing it or permissions are preventing it.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now