﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Article Discussions / Article Discussions by Author / Discuss content posted by Mohammed Moinudheen  / Moving files  / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Fri, 24 May 2013 13:27:01 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Moving files</title><link>http://www.sqlservercentral.com/Forums/Topic1165091-2643-1.aspx</link><description>Simple and easy question.</description><pubDate>Sun, 28 Aug 2011 00:30:44 GMT</pubDate><dc:creator>CoolCodeShare</dc:creator></item><item><title>RE: Moving files</title><link>http://www.sqlservercentral.com/Forums/Topic1165091-2643-1.aspx</link><description>Same here ;-)[quote][b]Tom.Thomson (8/25/2011)[/b][hr]Good question.I thought about this one for quite a bit.  Obviously I can move indices between filegroups, unless they support unmovable constraints (which can be fixed using DROP EXISTING) but I can't think of any way to move a file except to remove it and then add it back elsewhere - and I'm not at all sure that that will preserve the content (maybe it deletes the file and creates a new one? - one can't specify a filegroup when modifying a file , only when adding it); so the answer was probably "no" - so I got my point, not because I knew the answer but because to me it seemed to be the most probably correct answer.[/quote]</description><pubDate>Fri, 26 Aug 2011 11:12:42 GMT</pubDate><dc:creator>Wildcat</dc:creator></item><item><title>RE: Moving files</title><link>http://www.sqlservercentral.com/Forums/Topic1165091-2643-1.aspx</link><description>Nice Question Moinu.... But I got it wrong :-(</description><pubDate>Thu, 25 Aug 2011 15:59:39 GMT</pubDate><dc:creator>BuntyBoy</dc:creator></item><item><title>RE: Moving files</title><link>http://www.sqlservercentral.com/Forums/Topic1165091-2643-1.aspx</link><description>I got it wrong because I was reading 'Data files can be moved...' when I was actually thinking 'Data can be moved..'Welll, reading questions correctly is also part of the challenge :-P</description><pubDate>Thu, 25 Aug 2011 13:01:53 GMT</pubDate><dc:creator>sdelachapelle</dc:creator></item><item><title>RE: Moving files</title><link>http://www.sqlservercentral.com/Forums/Topic1165091-2643-1.aspx</link><description>good question - thanks</description><pubDate>Thu, 25 Aug 2011 10:34:37 GMT</pubDate><dc:creator>OzYbOi d(-_-)b</dc:creator></item><item><title>RE: Moving files</title><link>http://www.sqlservercentral.com/Forums/Topic1165091-2643-1.aspx</link><description>I got this one wrong but I learned something...</description><pubDate>Thu, 25 Aug 2011 10:13:28 GMT</pubDate><dc:creator>Revenant</dc:creator></item><item><title>RE: Moving files</title><link>http://www.sqlservercentral.com/Forums/Topic1165091-2643-1.aspx</link><description>Nice question. thanks</description><pubDate>Thu, 25 Aug 2011 09:55:22 GMT</pubDate><dc:creator>KWymore</dc:creator></item><item><title>RE: Moving files</title><link>http://www.sqlservercentral.com/Forums/Topic1165091-2643-1.aspx</link><description>Thanks for the question.</description><pubDate>Thu, 25 Aug 2011 09:52:48 GMT</pubDate><dc:creator>SQLRNNR</dc:creator></item><item><title>RE: Moving files</title><link>http://www.sqlservercentral.com/Forums/Topic1165091-2643-1.aspx</link><description>Thanks for the question!</description><pubDate>Thu, 25 Aug 2011 08:32:40 GMT</pubDate><dc:creator>skrilla99</dc:creator></item><item><title>RE: Moving files</title><link>http://www.sqlservercentral.com/Forums/Topic1165091-2643-1.aspx</link><description>Good question.I thought about this one for quite a bit.  Obviously I can move indices between filegroups, unless they support unmovable constraints (which can be fixed using DROP EXISTING) but I can't think of any way to move a file except to remove it and then add it back elsewhere - and I'm not at all sure that that will preserve the content (maybe it deletes the file and creates a new one? - one can't specify a filegroup when modifying a file , only when adding it); so the answer was probably "no" - so I got my point, not because I knew the answer but because to me it seemed to be the most probably correct answer.</description><pubDate>Thu, 25 Aug 2011 08:11:07 GMT</pubDate><dc:creator>L' Eomot Inversé</dc:creator></item><item><title>RE: Moving files</title><link>http://www.sqlservercentral.com/Forums/Topic1165091-2643-1.aspx</link><description>Great question. Read it way to fast.  Was thinking about the objects and not the physical file and clicked yes like 60% so far.  WOW!Bet we will see this one again. :cool:</description><pubDate>Thu, 25 Aug 2011 07:26:04 GMT</pubDate><dc:creator>SanDroid</dc:creator></item><item><title>RE: Moving files</title><link>http://www.sqlservercentral.com/Forums/Topic1165091-2643-1.aspx</link><description>Data_God,the structure of table is allocated on primary filegroup or mdf file!!!! when you do references 'on filegroup .....' on table, you are saying: "the DATA/Records will allocated in filegroup"</description><pubDate>Thu, 25 Aug 2011 06:35:37 GMT</pubDate><dc:creator>rfr.ferrari</dc:creator></item><item><title>RE: Moving files</title><link>http://www.sqlservercentral.com/Forums/Topic1165091-2643-1.aspx</link><description>[quote][b]Data_God (8/25/2011)[/b][hr]I got this one wrong but only after I tried using the script below on my SQL Server 2008 R2 environment. Could someone explain why the script below allows me to move a file between Filegroups? The script removes the file from one file group and then adds it to another. I understand that the file is physically removed from the file system and then a new file is created on the file system when the script adds a file to the other filegroup but why do the select statements selecting data from Table_1 continue to work?....[/quote]It's easy!!! you must include data in table and to try remove data file... and verify if  this script works.</description><pubDate>Thu, 25 Aug 2011 06:23:04 GMT</pubDate><dc:creator>rfr.ferrari</dc:creator></item><item><title>RE: Moving files</title><link>http://www.sqlservercentral.com/Forums/Topic1165091-2643-1.aspx</link><description>[quote][b]Kwex (8/25/2011)[/b][hr]Did more people actually tick "True"??? :-)[/quote]Well, if many of them were like me, and read the question before coffee, and allowed one's brain to answer the question they *thought* was being asked rather than the one that was *actually* being asked, then yes... :blush:Good morning, brain. The question said data files. It meant data files. Not some other thing that you substituted for data files in a fit of failing to think...  ;-)</description><pubDate>Thu, 25 Aug 2011 06:17:55 GMT</pubDate><dc:creator>Kiara</dc:creator></item><item><title>RE: Moving files</title><link>http://www.sqlservercentral.com/Forums/Topic1165091-2643-1.aspx</link><description>Thanks for the question.</description><pubDate>Thu, 25 Aug 2011 06:07:36 GMT</pubDate><dc:creator>Mattrick</dc:creator></item><item><title>RE: Moving files</title><link>http://www.sqlservercentral.com/Forums/Topic1165091-2643-1.aspx</link><description>Yep, that makes sense.Thanks</description><pubDate>Thu, 25 Aug 2011 05:55:29 GMT</pubDate><dc:creator>Data_God</dc:creator></item><item><title>RE: Moving files</title><link>http://www.sqlservercentral.com/Forums/Topic1165091-2643-1.aspx</link><description>[quote][b]Data_God (8/25/2011)[/b][hr]I got this one wrong but only after I tried using the script below on my SQL Server 2008 R2 environment. Could someone explain why the script below allows me to move a file between Filegroups? The script removes the file from one file group and then adds it to another. I understand that the file is physically removed from the file system and then a new file is created on the file system when the script adds a file to the other filegroup but why do the select statements selecting data from Table_1 continue to work?[/quote]TABLE_1 was assigned to the filegroup, not to any specific file within that filegroup.  That's why the table was still available when you removed a file from the filegroup.  What you did, effectively, was not to move the file, but to remove it and then create a new one with exactly the same name, size and file name on a different filegroup.Hope that makes sense!John</description><pubDate>Thu, 25 Aug 2011 05:52:08 GMT</pubDate><dc:creator>John Mitchell-245523</dc:creator></item><item><title>RE: Moving files</title><link>http://www.sqlservercentral.com/Forums/Topic1165091-2643-1.aspx</link><description>Glad I just answered and got it correct. I almost convinced myself I was missing something and checked true. Thanks for the question.</description><pubDate>Thu, 25 Aug 2011 05:50:33 GMT</pubDate><dc:creator>Britt Cluff</dc:creator></item><item><title>RE: Moving files</title><link>http://www.sqlservercentral.com/Forums/Topic1165091-2643-1.aspx</link><description>I though to myself if this was a tricky question when I read it... I'm glad it wasn't.@Data_God: I guess what the script is doing is reconfiguring your filegroups because it has to remove the file and then add it to another filegroup. Maybe someone more experienced could explain that behaviour better to me... :)Thanks for the question.Best regards,</description><pubDate>Thu, 25 Aug 2011 05:37:51 GMT</pubDate><dc:creator>codebyo</dc:creator></item><item><title>RE: Moving files</title><link>http://www.sqlservercentral.com/Forums/Topic1165091-2643-1.aspx</link><description>I got this one wrong but only after I tried using the script below on my SQL Server 2008 R2 environment. Could someone explain why the script below allows me to move a file between Filegroups? The script removes the file from one file group and then adds it to another. I understand that the file is physically removed from the file system and then a new file is created on the file system when the script adds a file to the other filegroup but why do the select statements selecting data from Table_1 continue to work?USE [master]GO/****** Object:  Database [Test]    Script Date: 08/25/2011 07:09:25 ******/IF  EXISTS (SELECT name FROM sys.databases WHERE name = N'Test')DROP DATABASE [Test]GOUSE [master]GO/****** Object:  Database [Test]    Script Date: 08/25/2011 07:09:25 ******/CREATE DATABASE [Test] ON  PRIMARY ( NAME = N'Test', FILENAME = N'C:\SQL Server User Databases\Test.mdf'),  FILEGROUP [SECONDARY] ( NAME = N'Test2', FILENAME = N'C:\SQL Server User Databases\Test2.ndf'), ( NAME = N'Test3', FILENAME = N'C:\SQL Server User Databases\Test3.ndf'), FILEGROUP [THIRDGROUP]( NAME = N'Test4', FILENAME = N'C:\SQL Server User Databases\Test4.ndf')  LOG ON ( NAME = N'Test_log', FILENAME = N'C:\SQL Server User Databases\Test_log.ldf')GOALTER DATABASE [Test] SET COMPATIBILITY_LEVEL = 100GOUSE TestGOIF EXISTS	(		SELECT	1		FROM	INFORMATION_SCHEMA.TABLES	T		WHERE	T.TABLE_NAME	=	'TABLE_1'		AND		T.TABLE_SCHEMA	=	'dbo'	)BEGIN	DROP TABLE	TABLE_1ENDGOCREATE TABLE dbo.Table_1	(	C1 int NOT NULL IDENTITY (1, 1),	C2 varchar(50) NOT NULL	)  ON [THIRDGROUP]GOALTER TABLE dbo.Table_1 ADD CONSTRAINT	PK_Table_1 PRIMARY KEY CLUSTERED 	(	C1	) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]GOUSE TESTGOSELECT	*FROM	TABLE_1GOUSE [master]GOALTER DATABASE [Test]  REMOVE FILE [Test4]GOGOALTER DATABASE [Test] ADD FILE ( NAME = N'Test4', FILENAME = N'C:\SQL Server User Databases\Test4.ndf' , SIZE = 3072KB , FILEGROWTH = 1024KB )    TO FILEGROUP [SECONDARY]USE TESTGOSELECT	*FROM	TABLE_1GOUSE masterGOALTER DATABASE [Test]  REMOVE FILE [Test4]GOGOALTER DATABASE [Test] ADD FILE ( NAME = N'Test4', FILENAME = N'C:\SQL Server User Databases\Test4.ndf' , SIZE = 3072KB , FILEGROWTH = 1024KB )    TO FILEGROUP [THIRDGROUP]    USE TESTGOSELECT	*FROM	TABLE_1GO</description><pubDate>Thu, 25 Aug 2011 05:33:59 GMT</pubDate><dc:creator>Data_God</dc:creator></item><item><title>RE: Moving files</title><link>http://www.sqlservercentral.com/Forums/Topic1165091-2643-1.aspx</link><description>Thanks for the question. Had to think about just what "data file" entailed to get it correct.</description><pubDate>Thu, 25 Aug 2011 05:28:15 GMT</pubDate><dc:creator>Thomas Abraham</dc:creator></item><item><title>RE: Moving files</title><link>http://www.sqlservercentral.com/Forums/Topic1165091-2643-1.aspx</link><description>great question!!!!WOW!!! 59% of incorrect answer!!! for a conceptual question!!!!</description><pubDate>Thu, 25 Aug 2011 05:14:48 GMT</pubDate><dc:creator>rfr.ferrari</dc:creator></item><item><title>RE: Moving files</title><link>http://www.sqlservercentral.com/Forums/Topic1165091-2643-1.aspx</link><description>Nice question. Learned a few things while researching the answer.</description><pubDate>Thu, 25 Aug 2011 04:14:47 GMT</pubDate><dc:creator>Michael Lysons</dc:creator></item><item><title>RE: Moving files</title><link>http://www.sqlservercentral.com/Forums/Topic1165091-2643-1.aspx</link><description>Good question, thanks</description><pubDate>Thu, 25 Aug 2011 03:37:11 GMT</pubDate><dc:creator>Stewart "Arturius" Campbell</dc:creator></item><item><title>RE: Moving files</title><link>http://www.sqlservercentral.com/Forums/Topic1165091-2643-1.aspx</link><description>Did more people actually tick "True"??? :-)</description><pubDate>Thu, 25 Aug 2011 02:19:58 GMT</pubDate><dc:creator>Kwex</dc:creator></item><item><title>RE: Moving files</title><link>http://www.sqlservercentral.com/Forums/Topic1165091-2643-1.aspx</link><description>Good one, thanks!H.</description><pubDate>Thu, 25 Aug 2011 01:23:32 GMT</pubDate><dc:creator>Bex</dc:creator></item><item><title>RE: Moving files</title><link>http://www.sqlservercentral.com/Forums/Topic1165091-2643-1.aspx</link><description>Nice question, thanks.</description><pubDate>Thu, 25 Aug 2011 00:33:53 GMT</pubDate><dc:creator>Koen Verbeeck</dc:creator></item><item><title>Moving files </title><link>http://www.sqlservercentral.com/Forums/Topic1165091-2643-1.aspx</link><description>Comments posted to this topic are about the item [B]&lt;A HREF="/questions/Administration/74552/"&gt;Moving files &lt;/A&gt;[/B]</description><pubDate>Wed, 24 Aug 2011 21:14:26 GMT</pubDate><dc:creator>mohammed moinudheen</dc:creator></item></channel></rss>