Top "Sp-msforeachtable" questions

How to drop all tables in a SQL Server database?

I'm trying to write a script that will completely empty a SQL Server database. This is what I have so …

sql-server sql-server-2008 ssms sp-msforeachtable
SQL Server sp_msforeachtable usage to select only those tables which meet some condition

I am trying to write this query to find all tables with specific column with some specific value. This is …

sql-server sql-server-2008 stored-procedures sql-server-2005 sp-msforeachtable
Delete all views from Sql Server

By using this statement in SQL Server: EXEC sp_msforeachtable 'DROP TABLE ?' I know it's possible to delete all …

sql sql-server-2008 sp-msforeachtable
ALTER INDEX failed because of QUOTED_IDENTIFIER when running from sp_msForEachTable

When I try to rebuild an index on a table: ALTER INDEX ALL ON [dbo].[Allocations] REBUILD that works fine. …

sql-server sql-server-2008-r2 reindex sp-msforeachtable
SQL Server: How to make server check all its check constraints?

It seems that some scripts generated by Enterprise Manager* (or not, it doesn't matter) created check constraints WITH NOCHECK. Now …

sql-server sql-server-2000 check-constraints database-integrity sp-msforeachtable
How to exclude tables from sp_msforeachtable

I know that sp_msforeachtable allows to perform queries on all tables. I have 100 tables and I want to perform …

sql sql-server sp-msforeachtable