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.
Author |
Topic |
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2005-11-30 : 08:13:46
|
sonal writes "how to delete all records from all tables of particular database?" |
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2005-11-30 : 09:02:25
|
use msforeachtabledynamic sqldelete constructdisabling constraintsor script out all table structure, permissions and objects (udf, sp's, etc) to another db and dump existing db.search here for examples of each |
 |
|
TonyTheDBA
Posting Yak Master
121 Posts |
Posted - 2005-11-30 : 11:06:22
|
Rather than using DELETE FROM myTableI'd use TRUNCATE TABLE MyTableas its not logged. As Andrew Says though you need to drop all the foreign Key constraints first Or you need to manually arrange the the Truncate Table Scripts in the correct order.Personally I'd use the second approach which is to use DTS to copy the objects to an empty database, but not transfer the data.-- RegardsTony The DBA |
 |
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2005-11-30 : 11:35:38
|
"TRUNCATE" also required DBA/DBO access right....not every joesoap can run it. |
 |
|
|
|
|