Monday, March 26, 2012

Moving Tables/File Groups

Let's say you want to move a table from file group A to file group B. What
is the easiest way to do that? Create a differently named table in file
group B and then DTS over the data and then do renames? Is there an ALTER
TABLE statement that will work and just move it over?
If I remember right, there's a trick if it has a clustered index but most
or at least many of these tables will not have a clustered index.
Any help would be appreciated.Create a clustered index using the CREATE INDEX statement with the ON
FILEGROUP clause.
HTH
Jerry
"CLM" <CLM@.discussions.microsoft.com> wrote in message
news:F43CC8F6-36F7-4250-9844-576640C6BF1B@.microsoft.com...
> Let's say you want to move a table from file group A to file group B.
> What
> is the easiest way to do that? Create a differently named table in file
> group B and then DTS over the data and then do renames? Is there an ALTER
> TABLE statement that will work and just move it over?
> If I remember right, there's a trick if it has a clustered index but most
> or at least many of these tables will not have a clustered index.
> Any help would be appreciated.|||If you don't have a clustered index then you will have to create a new table
on the new filegroup and move the data over.
--
David Portas
SQL Server MVP
--
"CLM" <CLM@.discussions.microsoft.com> wrote in message
news:F43CC8F6-36F7-4250-9844-576640C6BF1B@.microsoft.com...
> Let's say you want to move a table from file group A to file group B.
> What
> is the easiest way to do that? Create a differently named table in file
> group B and then DTS over the data and then do renames? Is there an ALTER
> TABLE statement that will work and just move it over?
> If I remember right, there's a trick if it has a clustered index but most
> or at least many of these tables will not have a clustered index.
> Any help would be appreciated.|||David,
Is that correct? If he doesn't have a clustered index won't creating the
clustered index on the other filegroup move the data to the new filegroup?
HTH
Jerry
"David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org> wrote in message
news:r8CdnRQBjquCbd_enZ2dnUVZ8qCdnZ2d@.giganews.com...
> If you don't have a clustered index then you will have to create a new
> table on the new filegroup and move the data over.
> --
> David Portas
> SQL Server MVP
> --
> "CLM" <CLM@.discussions.microsoft.com> wrote in message
> news:F43CC8F6-36F7-4250-9844-576640C6BF1B@.microsoft.com...
>> Let's say you want to move a table from file group A to file group B.
>> What
>> is the easiest way to do that? Create a differently named table in file
>> group B and then DTS over the data and then do renames? Is there an
>> ALTER
>> TABLE statement that will work and just move it over?
>> If I remember right, there's a trick if it has a clustered index but most
>> or at least many of these tables will not have a clustered index.
>> Any help would be appreciated.
>|||That's true. What I meant was that if you don't *want* to have a clustered
index you will have to create a new table. Of course it's questionable
whether it makes sense for many or most tables not to have a clustered
index. Sometimes you don't want a clustered index but more often it makes
sense to have one on every table.
--
David Portas
SQL Server MVP
--
"Jerry Spivey" <jspivey@.vestas-awt.com> wrote in message
news:udkaeiSyFHA.2212@.TK2MSFTNGP15.phx.gbl...
> David,
> Is that correct? If he doesn't have a clustered index won't creating the
> clustered index on the other filegroup move the data to the new filegroup?
> HTH
> Jerry
> "David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org> wrote in message
> news:r8CdnRQBjquCbd_enZ2dnUVZ8qCdnZ2d@.giganews.com...
>> If you don't have a clustered index then you will have to create a new
>> table on the new filegroup and move the data over.
>> --
>> David Portas
>> SQL Server MVP
>> --
>> "CLM" <CLM@.discussions.microsoft.com> wrote in message
>> news:F43CC8F6-36F7-4250-9844-576640C6BF1B@.microsoft.com...
>> Let's say you want to move a table from file group A to file group B.
>> What
>> is the easiest way to do that? Create a differently named table in file
>> group B and then DTS over the data and then do renames? Is there an
>> ALTER
>> TABLE statement that will work and just move it over?
>> If I remember right, there's a trick if it has a clustered index but
>> most
>> or at least many of these tables will not have a clustered index.
>> Any help would be appreciated.
>>
>sql

No comments:

Post a Comment