Migrate .ndf into .mdf

Hello Experts,
Is there a way to migrate an .ndf file back into the .mdf. They are both in the same filegroup of course, and I rememeber reading somewhere this could be done. Any assistance is greatly appreciated even if its to tell me that it can't be done.
Thanks,

JackW
JackW9653Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

binarykukiCommented:

First of all make sure you backup the database. Next would running DBCC command and shrink that file. Then you would remove ndf entry. Below are the commands

DBCC SHRINKFILE (DATAFILE.NDF,EMPTYFILE)
ALTER DATABASE <databasename> REMOVE FILE 'DATAFILE.NDF'

DATAFILE.NDF= Logical Name

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
binarykukiCommented:
Search BOL for DBCC SHRINKFILE
0
JackW9653Author Commented:
Thanks Kuki for your reply,  after a closer examination of the database there are 3 filegroups. One is the Primary and the other 2 match the names of the .ndf files. I rewrote my restore script using With Recovery, Replace and specified the .ndf files using MOVE TO and that worked to get all the tables so i can view them.

Thanks again for your solution, that was the method I was trying to remember.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.