As the title says, what are the full requirements to get a SQL transaction running with SQL Server? The transaction will eventually get more complex, but so far the debugging process has left me with stripping out all the logic (and nearly tearing my hair out).
Some precursory info that may help.
\n
does not deliminate statements).the current code is as follows:
BEGIN TRANSACTION Test_Transaction
SELECT COUNT(*) FROM schema.table;
COMMIT TRANSACTION
It really is that simple at the moment, the error I get out is:
SQL Error [42601]: ERROR: syntax error at or near "SELECT"
Position: 21
It's suggesting a syntax error at the SELECT
but it really doesn't matter what I put in the transaction, it just fails at the first input after the line BEGIN TRANSACTION Test_Transaction
, that is why I'm thinking I've missed a requirement of SQL Transactions to get them running.
Super spot from @Larnu in the comments! The error code shown is not high enough for SQL Server, so, on checking my connection settings, I realised my DB Connection in DBeaver was using Postgres as its driver. Changing this got things running.