I'd like to know if I'm able to use a CTE inside a transaction block like so:
BEGIN TRANSACTION WITH CTE ..... SELECT.....etc. COMMIT TRANSACTION
Any insight will be appreciated.
yes you can use a CTE within a transaction, the only point I would make is that you need to inlcude the ';' statement terminator
BEGIN TRANSACTION ;WITH CTE ..... SELECT.....etc. COMMIT TRANSACTION
Yes, there's absolutely no reason why not. You may need to make sure the statement before the cte is terminated with a semicolon, but that's about all...
No one has followed this question yet.