You're right, doesn't work. I trusted the blog myself, so haven't tried. But I just tried on a test database I have and got a similar error.
Try alternative solution (also referenced in the comments to that blog)
http://nathondalton.wordpress.com/2010/08/12/delete-table-data-reset-identities-in-sql/or solution #1 from the blog itself.
>>>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
>>
>
>Hmmm, I run the following:
>
>
>EXEC sp_MSForEachTable 'ALTER TABLE ? NOCHECK CONSTRAINT ALL'
>GO
>EXEC sp_MSForEachTable 'TRUNCATE TABLE ?'
>GO
>EXEC sp_MSForEachTable 'ALTER TABLE ? CHECK CONSTRAINT ALL'
>
>
>and I get
>
>
>Cannot truncate table 'dbo.aspnet_Roles' because it is being referenced by a FOREIGN KEY constraint.
>
If it's not broken, fix it until it is.
My Blog