ใน MS SQL Server มี Stored Procedure ตัวหนึ่งที่มีประโยชย์ในการจะทำอะไรกับ Table ทุก Table ใน Database ตัวอย่างการใช้ Stored Procedure sp_MSForEachTable นับจำนวน record ทั้งหมดของทุก Table ใน Database EXEC sp_MSForEachTable ‘SELECT ”?”, COUNT(*) FROM ?’ หรือ sp_MSforeachtable @command1=” declare @tmp int select @tmp=count(*) from ?…