clear markdown help donate comments/suggestions/bugs a leap of faith?
clear markdown donate comments/suggestions/bugs a leap of faith?
By using dbfiddle, you agree to license everything you submit by Creative Commons CC0

SET TRANSACTION ISOLATION LEVEL SNAPSHOT; CREATE TABLE dbo.T (n integer NULL);

CREATE TRIGGER trg ON dbo.T AFTER INSERT AS BEGIN SELECT * INTO #i FROM Inserted CREATE INDEX i ON #i (n); END;

SET IMPLICIT_TRANSACTIONS ON; INSERT dbo.T (n) VALUES (1); SET IMPLICIT_TRANSACTIONS OFF;
Msg 3964 Level 16 State 1 Line 5 Transaction failed because this DDL statement is not allowed inside a snapshot isolation transaction. Since metadata is not versioned, a metadata change can lead to inconsistency if mixed within snapshot isolation.