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 |
|
sbadam9
Starting Member
1 Post |
Posted - 2006-07-21 : 11:08:32
|
| Hi frinds...i am new to SQL Server...i hve a situation of SQL server Database consists more than 500 different tables in single Db. i want to delete complete data(records) from all tables at once...What is the best way to get this one done...thank...i ll be very happy..recieve suggestion..thanksSrinivasBusiness Analyst.Pls reply... |
|
|
Srinika
Master Smack Fu Yak Hacker
1378 Posts |
Posted - 2006-07-21 : 11:10:50
|
| My Suggestion :Take a backup first (in case)Script the tables (drop / create) with indexes ...., run the script.Srinika |
 |
|
|
DMWCincy
Starting Member
11 Posts |
Posted - 2006-07-21 : 15:17:03
|
The faster way is what Srinika but for the fun of it you can do this also:declare @name varchar(100)set nocount onDeclare table_cursor Cursor forselect name from sysobjects where xtype = 'U' open table_cursorfetch next table_cursor into @namewhile @@fetch_status = 0begin exec 'truncate table ' + @name fetch next table_cursor into @nameend |
 |
|
|
|
|
|