I think the trick is to create the user-defined Statisticstatistic using the same name that the equivalent auto-generated Statisticstatistic would take.
Try dropping the auto-generated Statisticstatistic (or starting with a new, empty table) and using this:-
DECLARE @stmt NVARCHARnvarchar(4000);
SELECT @stmt
=
= N'CREATE STATISTICS [_WA_Sys_''
+ QUOTENAME
(
N'_WA_Sys_'
+ RIGHT(N'0000000' + CONVERT(NVARCHARnvarchar(3211), column_id), 8)
+ N'_'
+ SUBSTRING(CONVERT(NVARCHARnchar(328), CAST([object_id] AS VARBINARYbinary(324)), 12),
3, 10 )
+ N']N' ON '
+ QUOTENAME(OBJECT_SCHEMA_NAME([object_id]))
+ N'.'
+ QUOTENAME(OBJECT_NAME([object_id]))
+ N' ('
+ QUOTENAME([name])
+ N') WITH NORECOMPUTE, SAMPLE 0 ROWS;'
FROM sys.columns
WHERE
[object_id] = OBJECT_ID('dboN'dbo.X_NO_COLUMN_STATS')
AND [name] = 'COL_GROUP';N'COL_GROUP';
RAISERROR('%s', 0, 1, @stmt) WITH NOWAIT;
EXEC sp_executesql @stmt = @stmt
The [auto_created][auto_created]
and [user_created][user_created]
flags indicate the new Statisticstatistic was user-defined, and that it is not updated on data-modification:-
SELECT stat.[name],
stat.stats_id,
stat.auto_created,
stat.user_created,
stat.no_recompute,
sp.[rows],
sp.rows_sampled,
sp.modification_counter
FROM sys.stats AS stat
CROSS APPLY sys.dm_db_stats_properties
(stat.[object_id], stat.stats_id) AS sp
WHERE stat.[object_id] = OBJECT_ID('dboN'dbo.X_NO_COLUMN_STATS');
Without using the equivalent naming approach, the auto-generated Statisticstatistic looks and behaves as expected:-