Roilis Roilis - 1 year ago
400 0

No description

SQL

Change database compatibility level (2014)

ALTER DATABASE MyDatabase SET COMPATIBILITY_LEVEL = 120;

DECLARE @sql NVARCHAR(MAX) = N'';

SELECT @sql += CHAR(13) + CHAR(10) + 'UPDATE STATISTICS '
  + QUOTENAME(SCHEMA_NAME(schema_id)) 
  + '.' + QUOTENAME(name) + ' WITH FULLSCAN;'
  FROM sys.tables;

PRINT @sql;