[sp_estimate_data_compression_savings] is failed in a contained database
When executing the [spestimatedatacompressionsavings] in a contained database the following error occur:
Msg 12827, Level 16, State 1, Line 18
User-named PRIMARY KEY constraint 'sampleindexDBA05385A6FF40F888204D05C7D56D2Bclusteredpk' is not allowed on temp table '#sampletableDBA05385A6FF40F888204D05C7D56D2B' because it is being created in a contained database. Please consult the Books Online topic Understanding Contained Databases for more information on contained databases.
Msg 1750, Level 16, State 0, Line 18
Could not create constraint or index. See previous errors.
It probably because the proc is using temp table and there are known limitation using temp table in a contained database, as you can see in the following link:
It's critical since without it we can't estimate the compression ratio and we are using data compression before setting a database containment.