Running a speculative transaction in SQL Server I have a long-running transaction that I know is always going to be rolled back. 

Is there a way to run this transaction so that it doesn't acquire any locks in the database? The transaction inserts and updates rows, but these changes will never persist in the database and in general should not be visible to anybody outside the transaction.

Here is a more specific example.

Connection 1:

BEGIN TRAN
UPDATE foobar SET something = 1;
COMMIT


Connection 2:

BEGIN TRAN
UPDATE foobar SET something = 2;
ROLLBACK


I want to prevent connection 2 from blocking connection 1. I can add SQL statements in the transaction, but I cannot easily change the queries.
No, there isn't a built-in way to run a "speculative transaction" in SQL Server.

If multiple transactions make incompatible changes, there will be blocking. You would need separate copies of the data to avoid this.