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 |
|
RMehrabian
Starting Member
2 Posts |
Posted - 2007-08-17 : 08:59:28
|
| Hello, I have a question that I hope someone can clear up for me. I have come across a number of different suggestions on DB maintenance, for example reindexing with the following script:USE DatabaseName --Enter the name of the database you want to reindex DECLARE @TableName varchar(255) DECLARE TableCursor CURSOR FOR SELECT table_name FROM information_schema.tables WHERE table_type = 'base table' OPEN TableCursor FETCH NEXT FROM TableCursor INTO @TableName WHILE @@FETCH_STATUS = 0 BEGIN DBCC DBREINDEX(@TableName,' ',90) FETCH NEXT FROM TableCursor INTO @TableName END CLOSE TableCursor DEALLOCATE TableCursorMy question is, doesn't the maintenance plan have this functionality inherent in it when you create the maintenance jobs to reindex? Is there a benefit to scripting things out vs just using the maintenance plan wizard for this sort of thing and any of the items it covers? I came from an Oracle background where this was a no-brainer but I am a bit confused on the choices with SQL Server. Thanks. |
|
|
ashley.sql
Constraint Violating Yak Guru
299 Posts |
Posted - 2007-08-17 : 09:19:21
|
| its suppose to work the same no matter how u do it.but yes definitely you can do a few extra things with T-SQL and the GUI pre-defined but still can do most of the work-----------------------------------------------------------------------------------------------Ashley Rhodes |
 |
|
|
|
|
|