Arthur Fuller
fuller.artful at gmail.com
Mon Feb 16 14:16:36 CST 2009
Try inserting a 'GO' after each EXEC statement. Arthur On Mon, Feb 16, 2009 at 1:09 PM, Susan Harkins <ssharkins at gmail.com> wrote: > 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. > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > >