[dba-SQLServer] NEVERMIND (Fw: problem creating stored procedure)

Susan Harkins ssharkins at gmail.com
Mon Feb 16 12:23:17 CST 2009


You can ignore this one.

Susan H.


>I don't create a lot of sp's, so be gentle... I think the following should 
>work, but I get an error on the first EXEC:
>
> CREATE PROCEDURE sp_DeleteAllData
>
> EXEC sp_MSForEachTable 'ALTER TABLE ? NOCHECK CONSTRAINT ALL'
>
> EXEC sp_MSForEachTable 'ALTER TABLE ? DISABLE TRIGGER ALL'
>
> GO
>
> EXEC sp_MSForEachTable 'DELETE FROM ?'
>
> GO
>
> EXEC sp_MSForEachTable 'ALTER TABLE ? CHECK CONSTRAINT ALL'
>
> EXEC sp_MSForEachTable 'ALTER TABLE ? ENABLE TRIGGER ALL'
>
> GO
>
>
>
> The statements work separately, so it isn't the statements, but getting 
> them in a stored procedure together has proved challenging. I've deleted, 
> reorged -- done everything I can think and it just doesn't like EXEC. I 
> know enough to know EXEC may not be the problem, but I don't know how to 
> troubleshoot it.
>
>
>
> Thanks!
>
> Susan H.
> 




More information about the dba-SQLServer mailing list