Discovered sp_MSforeach via this morning's Morning Dew. sp_MSforeach is a stored proc that will let you execute a block of code for every table in a database.

Here is a example

exec sp_MSforeach 'print "?"'

Which will print:

[dbo].[Customers] [dbo].[Orders]

etc

original article