File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1408,9 +1408,45 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14081408 ce
14091409 SET
14101410 ce.can_compress = 0,
1411- ce.reason = '' Table contains sparse columns or incompatible data types ''
1411+ ce.reason = '' Table contains sparse columns''
14121412 FROM #compression_eligibility AS ce
14131413 WHERE EXISTS
1414+ (
1415+ SELECT
1416+ 1/0
1417+ FROM ' + QUOTENAME (@current_database_name) + N' .sys.columns AS c
1418+ WHERE c.object_id = ce.object_id
1419+ AND
1420+ (
1421+ c.is_sparse = 1
1422+ )
1423+ )
1424+ OPTION(RECOMPILE);
1425+ ' ;
1426+
1427+ IF @debug = 1
1428+ BEGIN
1429+ PRINT @sql;
1430+ END ;
1431+
1432+ EXECUTE sys .sp_executesql
1433+ @sql;
1434+
1435+ SELECT
1436+ @sql = N'
1437+ SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
1438+
1439+ UPDATE
1440+ ce
1441+ SET
1442+ ce.can_compress = 0,
1443+ ce.reason = '' Index contains incompatible data types''
1444+ FROM #compression_eligibility AS ce
1445+ JOIN ' + QUOTENAME (@current_database_name) + N' .sys.indexes AS i
1446+ ON i.object_id = ce.object_id AND i.index_id = ce.index_id
1447+ WHERE ce.can_compress = 1
1448+ AND i.type = 1
1449+ AND EXISTS
14141450 (
14151451 SELECT
14161452 1/0
@@ -1420,8 +1456,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14201456 WHERE c.object_id = ce.object_id
14211457 AND
14221458 (
1423- c.is_sparse = 1
1424- OR t.name IN (N'' text'' , N'' ntext'' , N'' image'' )
1459+ t.name IN (N'' text'' , N'' ntext'' , N'' image'' )
14251460 )
14261461 )
14271462 OPTION(RECOMPILE);
You can’t perform that action at this time.
0 commit comments