T-SQL Ergebnistabelle (Daily Check)

Wenn man mehrere Tabellen als Daily Check absichern will, kann man sich diese Werte in eine Tabellenvariable speichern und sich ausgeben lassen:

DECLARE @TABLE AS TABLE(name nvarchar(128) PRIMARY KEY, countrows INT)
 
INSERT INTO @TABLE (name, countrows) VALUES
('table1', (SELECT COUNT(id) AS countrows FROM table1)),
('table2', (SELECT COUNT(id) AS countrows FROM table2));
 
SELECT * FROM @TABLE;

Ich habe noch keinen Weg gefunden, das Ergebnis als View zu speichern, stay tuned