How do change the table filegroup by script | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

How do change the table filegroup by script

Hi, I just like to know. How do change the Table Filegroup by script? Amit Kumar
Mob.: 9873812005
You can move a table to another filegroup by (re)creating a clustered
index on the table, specifying the desired filegroup. You can similarly
move the non-clustered indexes. For existing indexes, specify WITH
DROP_EXISTING to eliminate the sort. CREATE CLUSTERED INDEX test ON test_table (column1) ON NewFilegroup CREATE CLUSTERED INDEX test ON test_table (column1) ON NewFilegroup
WITH
DROP_EXISTING
MohammedU.
Moderator
SQL-Server-Performance.com All postings are provided “AS IS” with no warranties for accuracy.

<br /><br /><br /><br /><br /><blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><i>Originally posted by MohammedU</i><br /><br />You can move a table to another filegroup by (re)creating a clustered <br />index on the table, specifying the desired filegroup. You can similarly <br />move the non-clustered indexes. For existing indexes, specify WITH <br />DROP_EXISTING to eliminate the sort. <br /><br />CREATE CLUSTERED INDEX test ON test_table (column1) ON NewFilegroup <br /><br />CREATE CLUSTERED INDEX test ON test_table (column1) ON NewFilegroup <br />WITH <br />DROP_EXISTING<br /><br /><br />MohammedU.<br />Moderator<br />SQL-Server-Performance.com<br /><br />All postings are provided “AS IS” with no warranties for accuracy.<br /><br />Hi,<br /><br />[<img src=’/community/emoticons/emotion-1.gif’ alt=’:)‘ />]Thank you very much for information and help.[<img src=’/community/emoticons/emotion-1.gif’ alt=’:)‘ />]<br /><br /><hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote"><br /><br />Amit Kumar<br />Mob.: 9873812005
If you are moving for perfomance reasons, it is better to create new filegroup on different physical drives. Optimizing SQL Server Performance
Using Files and Filegroups
http://www.sql-server-performance.com/ac_filegroup_performance.asp
MohammedU.
Moderator
SQL-Server-Performance.com All postings are provided “AS IS” with no warranties for accuracy.

]]>