SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Moving files


Moving files

Author
Message
Britt Cluff
Britt Cluff
SSCommitted
SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)

Group: General Forum Members
Points: 1799 Visits: 253
Glad I just answered and got it correct. I almost convinced myself I was missing something and checked true. Thanks for the question.

http://brittcluff.blogspot.com/
John Mitchell-245523
John Mitchell-245523
SSChampion
SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)

Group: General Forum Members
Points: 13996 Visits: 15944
Data_God (8/25/2011)
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?


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
Data_God
Data_God
SSCrazy
SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)

Group: General Forum Members
Points: 2236 Visits: 561
Yep, that makes sense.
Thanks
Mattrick
Mattrick
SSChasing Mays
SSChasing Mays (626 reputation)SSChasing Mays (626 reputation)SSChasing Mays (626 reputation)SSChasing Mays (626 reputation)SSChasing Mays (626 reputation)SSChasing Mays (626 reputation)SSChasing Mays (626 reputation)SSChasing Mays (626 reputation)

Group: General Forum Members
Points: 626 Visits: 767
Thanks for the question.
Kiara
Kiara
SSC-Addicted
SSC-Addicted (455 reputation)SSC-Addicted (455 reputation)SSC-Addicted (455 reputation)SSC-Addicted (455 reputation)SSC-Addicted (455 reputation)SSC-Addicted (455 reputation)SSC-Addicted (455 reputation)SSC-Addicted (455 reputation)

Group: General Forum Members
Points: 455 Visits: 1426
Kwex (8/25/2011)
Did more people actually tick "True"??? :-)


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... ;-)

-Ki
rfr.ferrari
rfr.ferrari
SSCommitted
SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)

Group: General Forum Members
Points: 1533 Visits: 13627
Data_God (8/25/2011)
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?
....


It's easy!!! you must include data in table and to try remove data file... and verify if this script works.


rfr.ferrari
DBA - SQL Server 2008
MCITP | MCTS

remember is live or suffer twice!
the period you fastest growing is the most difficult period of your life!

rfr.ferrari
rfr.ferrari
SSCommitted
SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)

Group: General Forum Members
Points: 1533 Visits: 13627
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"


rfr.ferrari
DBA - SQL Server 2008
MCITP | MCTS

remember is live or suffer twice!
the period you fastest growing is the most difficult period of your life!

SanDroid
SanDroid
SSCommitted
SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)

Group: General Forum Members
Points: 1574 Visits: 1046
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
TomThomson
TomThomson
SSChampion
SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)

Group: General Forum Members
Points: 14224 Visits: 12197
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.

Tom

skrilla99
skrilla99
Ten Centuries
Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)

Group: General Forum Members
Points: 1291 Visits: 1321
Thanks for the question!



Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search