When contract.enforced = true, the sqlserver__create_table_as macro uses CREATE TABLE + INSERT INTO ... SELECT instead of SELECT INTO. On SQL Server, INSERT INTO a heap is fully logged, while SELECT INTO is minimally logged (in simple/bulk-logged recovery). For high-volume tables this causes the transaction log to fill completely and the query to fail.
Relatively simple fix, adding a tablock to the create table macro for the contract branch will use the same minimal logging when operating under simple/bulk-logged recovery mode.
When
contract.enforced = true, thesqlserver__create_table_asmacro usesCREATE TABLE+INSERT INTO ... SELECTinstead ofSELECT INTO. On SQL Server,INSERT INTOa heap is fully logged, whileSELECT INTOis minimally logged (in simple/bulk-logged recovery). For high-volume tables this causes the transaction log to fill completely and the query to fail.Relatively simple fix, adding a tablock to the create table macro for the contract branch will use the same minimal logging when operating under simple/bulk-logged recovery mode.