[dba-SQLServer] ?s on sp_MSForEachTable

Susan Harkins ssharkins at gmail.com
Wed Jan 14 09:57:52 CST 2009


Well, that's good to know -- no clue what's going on at my end. Thank you 
for testing it.

Susan H.


I tried this on both AdventureWorks using SQL Server 2000 and
AdventureWorks2008 using SQL Server 2005, and I *did* get error messages for
failing deletes due to constraint violations, as expected.
Don't know why the error messages are missing in your setup.


Maybe you can help. When I run the following statement

EXEC sys.sp_MSForEachTable 'DELETE FROM ?'

I should get an error on tables with constraints to other tables.
Interesting, when I run TRUNCATE TABLE, I see those errors. With DELETE
FROM, I see a message that the statement's been completed successfully
instead of seeing the expected error messages for related tables. Should I
see an error message for these tables or does it just happily delete what it

can and ignore the tables it can't?

Susan H.





More information about the dba-SQLServer mailing list