SQL Server: Use sp_MSforeachtable to apply a T-SQL command to every table of current Database

In this post, I am sharing the use of sp_MSforeachtable stored procedure of SQL Server. This is an undocumented object of SQL Server, but still, you can use this stored procedure. When we require executing same T-SQL command for all the tables, we can use this stored procedure. Many times we need to run drop/truncate … Continue reading SQL Server: Use sp_MSforeachtable to apply a T-SQL command to every table of current Database