>>>Yeah, but that complains when I have FK constraints set.
>>
>>Take a look at this blog post
>>
>>
Delete all data in all tables in a database when you have foreign keys>>
>>From comment by Denis Gobo to this blog post:
>>
>>
>>
>>EXEC sp_MSForEachTable 'ALTER TABLE ? NOCHECK CONSTRAINT ALL'
>>GO
>>
>>EXEC sp_MSForEachTable 'TRUNCATE TABLE ?'
>>GO
>>
>>
>>EXEC sp_MSForEachTable 'ALTER TABLE ? CHECK CONSTRAINT ALL'
>>GO
>>
>
>I was joking when I said I wanted a script to do everything I wanted. You didn't actually have to go and find me one.
>
>Thanks!
You're welcome. I didn't have to go and find it, I knew about this blog post.
If it's not broken, fix it until it is.
My Blog