| Author |
Topic |
|
LerrynDT
Starting Member
3 Posts |
Posted - 2008-10-17 : 09:15:55
|
| Hi I am totally new to SQL, please can you tell me what the following script would be used for on any SQL tables - _____________________________________________________USE MMSv3_DemoData DECLARE @TableName varchar(255)DECLARE TableCursor CURSOR FORSELECT table_name FROM information_schema.tablesWHERE table_type = 'base table'OPEN TableCursorFETCH NEXT FROM TableCursor INTO @TableNameWHILE @@FETCH_STATUS = 0BEGIN DBCC DBREINDEX(@TableName,' ',90)FETCH NEXT FROM TableCursor INTO @TableNameENDCLOSE TableCursorDEALLOCATE TableCursor________________________________________________________Thanks in AdvanceThe Newbie! |
|
|
Transact Charlie
Master Smack Fu Yak Hacker
3451 Posts |
Posted - 2008-10-17 : 09:23:59
|
| IT will rebuild the indexes on all of the tables in your database.look up DBCC DBREINDEX in books on line.DBREINDEX is an offline job but typically it won't take long (depending on your table sizes of course)Make sure you don't run this on a live server unless you know exactly what it's going to do.NB: Changed "Look up DBREINDEX" to "Look up DBCC DBREINDEX" as the former wont find much!-------------Charlie |
 |
|
|
Transact Charlie
Master Smack Fu Yak Hacker
3451 Posts |
Posted - 2008-10-17 : 09:27:02
|
| And DBCC DBREINDEX will be depreciated in future versions of SQL Server. Functionality will be subsumed into the ALTER INDEX statement.-------------Charlie |
 |
|
|
LerrynDT
Starting Member
3 Posts |
Posted - 2008-10-17 : 09:29:23
|
| Thanks Charlie, makes a bit more sense to me now. |
 |
|
|
Transact Charlie
Master Smack Fu Yak Hacker
3451 Posts |
Posted - 2008-10-17 : 09:32:21
|
| Is it indexes or indices?-------------Charlie |
 |
|
|
LerrynDT
Starting Member
3 Posts |
Posted - 2008-10-17 : 09:49:19
|
| Isn't it Indices???? |
 |
|
|
tosscrosby
Aged Yak Warrior
676 Posts |
Posted - 2008-10-17 : 09:54:22
|
| Word's spellcheck accepts either one. I always use "indexes" but either would be acceptable in conversation. Besides, who are we trying to impress?? DBAs have there own language anyway!Terry |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-17 : 10:02:01
|
quote: Originally posted by tosscrosby Word's spellcheck accepts either one. I always use "indexes" but either would be acceptable in conversation. Besides, who are we trying to impress?? DBAs have there own language anyway!Terry
I've always used indexes rather than indices. |
 |
|
|
Transact Charlie
Master Smack Fu Yak Hacker
3451 Posts |
Posted - 2008-10-17 : 11:17:43
|
quote: Originally posted by visakh16
quote: Originally posted by tosscrosby Word's spellcheck accepts either one. I always use "indexes" but either would be acceptable in conversation. Besides, who are we trying to impress?? DBAs have there own language anyway!Terry
I've always used indexes rather than indices.
That's better than me. I usually end up referring to them as 'thingies' or 'whatdoyacallems'-------------Charlie |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-17 : 11:18:51
|
quote: Originally posted by Transact Charlie
quote: Originally posted by visakh16
quote: Originally posted by tosscrosby Word's spellcheck accepts either one. I always use "indexes" but either would be acceptable in conversation. Besides, who are we trying to impress?? DBAs have there own language anyway!Terry
I've always used indexes rather than indices.
That's better than me. I usually end up referring to them as 'thingies' or 'whatdoyacallems'-------------Charlie
Personalised jargons? |
 |
|
|
|