Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Clear all tables (Membership, Profile, Users, ...

Author  Topic 

shapper
Constraint Violating Yak Guru

450 Posts

Posted - 2007-02-24 : 07:19:42
Hello,

Can someone tell me a secure way to clean all records from ASP.NET 2.0
SQL 2005 tables (Membership, Profile, Users, ...) ?

Thanks,

Miguel

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-02-24 : 07:22:07
use
truncate table <table name>


KH

Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2007-02-26 : 15:25:13
If you've got referential integrity in place (foreign key constraints), then you must use DELETE FROM instead of TRUNCATE TABLE. In this case, you would need to delete from all child tables first before deleting from the parent, otherwise you'll get errors.

Tara Kizer
Go to Top of Page

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2007-02-27 : 02:43:53
drop database works too...


www.elsasoft.org
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-02-27 : 02:52:38
quote:
Originally posted by jezemine

drop database works too...


www.elsasoft.org



That would be too much Jesse!

Try Drop Table instead.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page
   

- Advertisement -