Moving ONE Table To A Different Filegroup Using T-SQL

Aug 29, 2002

I need to know if it is possible to move ONE table from an existing filegroup to another existing filegroup.
The answer I received to use ALTER database only modifies the file/filegroup name or changes the default filegroup.
Any assistance will be greatly appreciated.

View 1 Replies


ADVERTISEMENT

Moving Table(s) To A Different Filegroup In SQL 2005

Oct 2, 2007

Is there anyway to move tables without any indexes to a filegroup?

View 1 Replies View Related

Partitioned View Broken After Moving Table To New Filegroup

Jul 20, 2005

I am using SQL Server 2000, SP3.I created an updatable partitioned view awhile ago and it has beenrunning smoothly for some time. The partition is on a DATETIME columnand it is partitioned by month. Each month a stored procedure isscheduled that creates the new month's table, and alters the view toinclude it. Again... working like a charm for quite some time.This past weekend I moved some of the first tables onto a new filegroup. I did this through Enterprise Manager, by going into designmode for the table, then going into the properties for the table andchanging the file group there as well as in all of the indexes. Nowthe partitioned view is no longer updatable. It gives the errormessage: "UNION ALL view '<view name>' is not updatable because apartitioning column was not found."I have extracted the DDL for all of the partition tables and comparedthem and they all look the same. I checked and then double-checked theCHECK constraints to make sure that they were all valid and they are.If I remove the tables that I moved to the new file group from theview, then it is once again updatable, but when I put them back in itfails again.Any ideas? If you would like samples of the code then I can send italong, but it's rather large, so I have not included it here.Thanks!Thomas R. Hummel

View 3 Replies View Related

Moving Objects From One Filegroup To Another

Apr 25, 2000

I have my user defined objects created on the PRIMARY filegroup.
I have a secondary filegroup existing for the database.
How can I move all my user objects to the secondary filegroup from the
primary filegroup.
Info on this is appreciated.

regards
Sush.

View 1 Replies View Related

Moving Indices To New Filegroup

Mar 26, 2002

I have created a new filegroup and would like to move my indices there. Do I need to create a file for each index or can I just specify the filegroup in Enterprise Manager?

Thanks!

Ellen

View 1 Replies View Related

Moving Datafile To Different Filegroup

Nov 10, 2005

Hi,
In SQL Server 2000 how to move a secondary data file to different filegroup without removing and re-creating the secondary data file.

Thanks in advance.
-S

View 1 Replies View Related

Moving A Heap To Another Filegroup

Jul 20, 2005

I have a big table (heap)... well, not so big, I have a small serverand I want to spread access to it across several new disks dedicatedonly to that table.I known its possible to do that creating a clustered index with "ONfilegroup" option but I want to maintain it as a heap, is there anyway to do this without dropping indexes/references - bulk unload -create table - bulk load - create indexes?.

View 4 Replies View Related

Moving Data From One Filegroup To Another.....but Wait, There Is More!!

May 13, 2008

OK, I know this is out there all over and yes I did a search for this topic; however, I am confused about tables with an image data type and with moving text file group to another filegroup.

Here is what I have:

I have a table storing imaged documents and has become very large. I want to move the table to another filegroup. The table is created like this:

USE [PD51_Data]
GO
/****** Object: Table [dbo].[SCANNEDDOCUMENTS] Script Date: 05/13/2008 14:52:40 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[SCANNEDDOCUMENTS](
[DocID] [int] IDENTITY(1,1) NOT NULL,
[CaseID] [int] NOT NULL,
[DocName] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Doc] [image] NOT NULL,
[DocLocation] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[DocNotes] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[TopicID] [int] NULL,
[ScannedDocumentsCheckSum] [varchar](128) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,PRIMARY KEY CLUSTERED
(
[DocID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
ALTER TABLE [dbo].[SCANNEDDOCUMENTS] WITH NOCHECK ADD CONSTRAINT [ISCANNEDDOCUMENTS2] FOREIGN KEY([TopicID])
REFERENCES [dbo].[TOPICS] ([TopicID])
GO
ALTER TABLE [dbo].[SCANNEDDOCUMENTS] CHECK CONSTRAINT [ISCANNEDDOCUMENTS2]

On a test DB, I moved the clustered and nonclustered indexes to a secondary filegroup no problem, but it still shows to be stored in the primary filegroup. I read an article about having to create a new table in the secondary in order to move the images and text file group. Has anyone come across this?

Do I need to drop the clustered index and FK to move to a secondary filegroup?

Or

Do I create a new table into the secondary filegroup and then add the Clustered index and constraints?

View 4 Replies View Related

SQL Server 2008 :: Moving Into A Specific Filegroup

Jun 3, 2015

SQL 2008 R2

I have a partitioned table in which one of the partitions is on the Primary filegroup. I want to move the data off of that Primary filegroup, and and on to a new filegroup named RTFG6.

Scheme and function currently defined as:

CREATE PARTITION SCHEME [PS1_Left_id] AS PARTITION [PF1_Left_id] TO ([RTFG1], [RTFG2], [RTFG3], [RTFG4], [RTFG5], [PRIMARY])

CREATE PARTITION FUNCTION [PF1_Left_id](int) AS RANGE LEFT FOR VALUES (10, 15, 35, 48, 53)

I've tried split and merge, and for whatever reason, always end up with the Primary filegroup holding data.

How do i get it off of Primary completely, and onto RTFG1 to RTFG6?

I don't want to export to a holding table and re-create the table if i can avoid it, due to identity columns and relationships with multiple tables.

View 0 Replies View Related

Move Table To Different Filegroup

Oct 28, 2005

I will be moving production SQL databases (one is 25Gb, the other is 3Gb) to a new server. One of the reasons is the old server has only IDE disks while the new has raid (I don't know the configuration yet).
Database 1 has a primary and one other filegroup. I want to spread the disk I/O by moving table A to it's own filegroup on it's own disk.
For the purposes of testing I have
1. brought a database onto a test server (using sp_detach_db, copying the files and attaching using sp_attach_db)
2. created a new filegroup
3. created a physical file on disk, allocated space and associated with my new filegroup

my question is how do I now move table A into this file?

View 1 Replies View Related

Move Table To Other Filegroup?

Jul 8, 2004

Hi every body,

Is there anyone know the way to move a table with data to other file group?

View 3 Replies View Related

Locate Table To Filegroup

Sep 18, 2005

I have created a new filegroup,and i want to add existing table to the file group.
I don't have the appropriate syntax for this.

Please Help.

Regards Mr. Mumin
Thanks All,

View 1 Replies View Related

Move Table To Different Filegroup

Dec 9, 2007

SQl experts and gurus:

How to move tables to the new filegroup which i created. suppose my database has only primary FG and after that i added one FG and due to performance reasons i want to move the existing table to NEW FG.
Thanks.

View 20 Replies View Related

Can I Create A Filegroup On Existnig Table

Feb 22, 2001

Can I create a filegroup on existnig table?If yes,How?
TIA

View 3 Replies View Related

Change Table File Group Filegroup

May 10, 2007

Hi There



I am running SQL Server 2005 Enterprise Edition, i want to split my data and indexes on different drives.



In 2000 i had to recreate clustered indexes and non clustered indexes on the correct filegroups to accomplish this.



In 2005 i see there is a ALTER TABLE MOVE TO Filegroup option, thats cool.



Does this effectively do the same as rebuilding the clustered index on the new filegroup? Will this leave the other indexes of the table on the primay filegroup or move them as well ?



If i wanted to also move the non clustered indexes is there a better way to move them that drop and re-create on the new filegroup in 2005, i see the ALTER INDEX statement does not support a move to filegroup option.



In a nutshell what is the best/easiest way to move exisitng table data and indexes to new file groups in Sql Server 2005 Enterprise Edition?



Thanx

View 10 Replies View Related

How To Change An Existing Table From A Filegroup To A Partition

May 21, 2008

I've create a partition function and a partion scheme for my database.
Now I would like to change an existing table to use these partition.
The table is replicated.
How can I do this?


Thanks
Markus

View 2 Replies View Related

Moving From One Table To Other Table Automatically For Every 3 Months By Checking The Paticular Value Of The Table Field

Mar 29, 2007

Hi
 
I am having a table called as status ,in that table one field is there i.e. currentstatus.
the rows which are having currentstatus as "ticket closed",i want to move those rows into  other table called repository which is having same table structure as status table.
I can do programatically.
but is there any way for every 3 months system has to check and do this action means moving to repository table automatically?
 
Please help me.
 
Thanks.

View 1 Replies View Related

SQL Server Admin 2014 :: Filegroup By Table Category

Oct 14, 2015

I'm being asked to create multiple filegroups for a new database based on the table type, transaction, lookup, misc... From what i'm reading this doesn't make sense. I'm reading either large tables get file groups, nonclustered indexes when they are about the same size of the data, or a few other reasons...

First of all, we are talking about the same disk (please don't ask me about how it is configured) and I'm not sure yet if restoring separate file groups is even going to be necessary.

So here are my questions (beyond, the test and see what happens) because in the end I'm going to probably have to do what i'm told. So this is for my professional knowledge.

1. Does file groups separated by table type make sense?
2. Should you put tables that are queried often together in the same or different file groups.
3. I'm pretty sure you can't restore single file group for write access, am I correct?

View 0 Replies View Related

DB Engine :: Disadvantage Of Creating A Table In Separate Filegroup

Aug 17, 2015

We have a table that we are using for inserts for every 2mins and it is a very large table.

I am panning to add this table to a separate file and file-group, so that i can keep this file in separate drive.And it will restore files level.

Is there any disadvantage if we create this table in this way.

View 8 Replies View Related

How To Move Existing Table Into A Different Filegroup Using Tsql Script

Jul 12, 2006

Hi,

How to move existing table(include its constraint and index) into a different filegroup using tsql in Sql Server 2000. We have 1000+ tables in our system and we are planning to move around 500 tables to a new file group, which is available on another SAN drive.

Regards.
Sankar N

View 1 Replies View Related

Clustered Versus Create Table On High Speed FILEGROUP

Nov 30, 2005

Hi,I am expanding our data warehouse solution with new filegroups onseveral subsystems.I want to know which idea is better!- create clustered indexes on tables to 'move' them to new filegroups- create these tables on the new filegroups.The background of this question is as follows:- we want the whole data on the new filegroups- we want to know if there is any difference in performance between the2 solutionsThanks in advance,Danny

View 4 Replies View Related

Moving Lots Of Rows From Table To Another Table

Jan 17, 2008

Hi all,



I have two tables within the SQL server and there is an application writes 20.000 or 40000 rows in the First table.

1) I need to know when the table completes filled to start move the data to the second table.

2) After I copy the rows I need to delete the rows from the first table.



I though to use the trigger but I am not sure if this is the best approach or not





Please help....



Thank you

sms

View 11 Replies View Related

Moving From One Table To Another

Apr 6, 2007

I am trying to write a stored procedure that copies one row from one table and moves it to another table. The two tables do not have exactly the same number of columns and not all of the columns that are the same in each table have the same name. I am using MS SQL Server 2000 and I cannot figure out a way to do this.

My big question is how do you execute a query in a stored procedure and then use the results to execute an update in the same procedure. I want the entire function to occur without the client application having to do any of the work.

Thanks,
Julian

View 1 Replies View Related

Moving Data From One Table To Another

May 27, 1999

Hi all,

This is (probably) a simple question, but I'm new to SQL Server scripting.

What I want be able to do is move data from one table in a database to another table in the same database, once one of the fields (a date field) reaches a certain value.

Specifically, we are inserting rows into a table that are stamped with an insert date and an expiry date. When the expiry date is reached, we want to move the applicable row from the original table to an identically structured table.

Ideally, we want this to be a script that is run daily.

Does anyone have any ideas or examples that we could use.

Any help is much appreciated!



Tim

View 3 Replies View Related

Moving Data From One Table To Another

Nov 10, 2004

I imported a little over 9 million records into my database without "cleaning" the data.

I'm looking for suggestions on what would be the most efficient way to get all the fields to the correct types and to insert decimals on the fields that need them.


My only idea thus far is to make another table with the correct field types and append the data to the new table.

View 1 Replies View Related

Moving A Table To A Different Schema

Aug 27, 2012

We currently have all tables in the dbo schema, but for organizational reason we would like to split them up in multiple schemas and I wonder if that can be done without re-creating the tables.

So my question is, is there a way to move a table into a different schema without re-creating it? (For those familiar with Postgres I'm looking for an equivalent to "ALTER TABLE foo SET SCHEMA newschema") sp_rename only allows a "one-part name" for the new name, so apparently that cannot be used.

View 2 Replies View Related

Need Help Moving Dates From One Table To Another Using A DTS...

May 17, 2004

I have a timestamp in one table that is of datetime type and I need to move it to a table with a Varchar(30) type. What is happening is a date that should be set up like this "11/12/2004" is actually coming across as "Nov 12 2004". I tried using a cast(fieldname) as Varchar(30) on the datetime type, but it didn't help. does anyone have any ideas on how to retain the original date form in moving it to a varchar type? thanks in advance...

View 6 Replies View Related

Moving One Table Form One DB To Another

May 8, 2014

Wondering if its possible to copy a table form one DB and paste to another dB? is there a tool for that?

View 7 Replies View Related

Moving A Big Table To Another Server. Best Way?

Oct 23, 2007

I have a table with 200 million rows which needs to be moved to a different instance. What is the best way to move the table while at the same time getting rid of any unused space in the table? I think BCP is the fastest way to do this, but I am conrned that the results would be different than exporting the t-sql equivalent and running that.

Any comments? BOL does not appear to address this issue very clearly. . .

Thanks,

Michael

View 4 Replies View Related

Moving Rows Up And Down In A Table

Oct 19, 2007

Hi all,

I am currently writing a web service that gets data from a MSSQL2000 DB and I need to get the data to create some drop down lists, but these lists are composed of many concatenated elements. To sort these alphabetically is proving to be a royal pain in the butt as they just come out as they are ordered in the DB.

It would be a whole lot easier if i could just reorder the rows in one relevant table. Does anyone know how to do this or if it is possible to move rows up or down?

Thanks a lot!

Richee.

View 22 Replies View Related

Moving A Column Of Data To Different Table.

May 1, 2008

Hi,

Here is my scenario simplified.

tbl1
userid, secondaryid

tbl2
userID, secondaryID

tbl1 is already populated. I just want to transfer the secondary ID to tbl2 based on the userID. I don't want to store secondaryID in tbl1 anymore.

View 4 Replies View Related

Moving Data From One Table To Another Using Variables

Oct 20, 2013

I need to move data from one table to another using variable percentages and business days.

Here is the basic idea:

Variables: varTable1, varTable2, varPercentage

Get varPercentage of rows of VarTable1 that have a date of "current business date -1" and place into varTable2.

View 1 Replies View Related

Moving Record From View To A Table

Mar 28, 2006

Hi All,
I have a view that contains 30 million records.I want to move the view to a table in my database using DTS,but it is taking a lot of time,and making my tempdb to grow fast in giga bytes.Please is there anyway i can copy this view into the table easily in minutes.The view structure and the table structure are the same.Also, how can I index a view and can I add unique key to a view.

Thanks All in advance.
Mokah

View 6 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved