Why is it not possible to create indexes on temp tables in SNAPSHOT isolation?

by Tom Pa┼żourek   Last Updated May 15, 2018 19:06 PM

When I try to create indexes on a temporary table in SQL Server when using the SNAPSHOT transaction isolation, I get this error:

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.

Why is it not allowed to create indexes on temporary tables in SQL Server when using snapshots?

I don't understand this, if I'm allowed to create temporary tables, why am I not allowed to add indexes to them?

Related Questions