[dba-SQLServer] ?s on sp_MSForEachTable

Arthur Fuller fuller.artful at gmail.com
Wed Jan 14 00:13:06 CST 2009


I am, and so is Tim Chapman, who has written a couple of extensions to it,
available from www.techrepubic.com

Arthur

On Tue, Jan 13, 2009 at 12:03 PM, Susan Harkins <ssharkins at gmail.com> wrote:

> I ran the following statement against a copy of AdventureWorks, expecting
> to
> see some constraint errors:
>
> EXEC sp_MSForEachTable 'DELETE FROM ?'
>
> Instead, the command was completely successfully -- by message, but of
> course, no data was deleted, which is what the statement should do --
> delete
> all the records from every table in the database. Of course, I didn't
> expect
> it to work because of the constraints, but I did expect to see some kind of
> error message.
>
> It's an undocumented sp and despite my efforts to figure this out, I'm not
> finding any help. I've found a lot of information on the different
> arguments
> and how it's supposed to run, but answers to the above question -- why not
> error message -- can't find that sort of information.
>
> Is anyone familiar with this sp?
>
> Susan H.
>



More information about the dba-SQLServer mailing list