notebook/IT/SQL/SCRIPTS SQL QSA ORSYS/DEMO maintenance DBCC CHECK.sql

13 lines
247 B
MySQL
Raw Normal View History

2020-11-26 17:38:25 +00:00
DECLARE @SQL NVARCHAR(max) = N'';
SELECT @SQL = @SQL + 'DBCC CHECKDB ([' + name + ']) WITH NO_INFOMSGS;'
FROM sys.databases
WHERE state = 0
AND source_database_id IS NULL
AND name NOT IN ('tempdb', 'model');
EXEC (@SQL);