Merge data files in MSSQL 2000

Hello,

I have a large db (~40GB) that has been divided into four parts because diskspace was running low on the hard disks. The db is now on four different volumes :( . We now have larger hard disks :) , so is there a way to merge all four data files to one data file?

Best Regards,
Benny
strobe0Asked:
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.

ShogunWadeCommented:
When you say it was divided in four parts, do you mean into 4 databases or do you mean 1 database with four data files ?
0
strobe0Author Commented:
1 database with four data files.
0
ShogunWadeCommented:
ok,  then the easiest thing is as follows :

1) increase the primary file size to a capacity to a little bit more than required to store all the data.
2) make sure that the other files are not set to autogrow
3) for each of the files, right click in EM the database and click properties,  goto the data files tab and delete  the secondary files.   the data will be moved to the primary file.
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
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

strobe0Author Commented:
Thanks a lot, do you know where I can found some documentation about this procedure?
0
ShogunWadeCommented:
I've never seen any published about it.   but i had a similar problem some time ago and this was the only way i could find to do it.
0
strobe0Author Commented:
When I try to remove the other data files the following error message occurs:
Error 5042: The file 'test_Data_two' cannot be removed because it is not empty.
What am I doing wrong?
0
ShogunWadeCommented:
ah sorry missed one vital step.    

2a)  goto Shrink Database click files, selectthe file you want to get rid of and then click the option to empty this into other files.

this will make the file empty and then deleted it as described prviously
0
strobe0Author Commented:
Thanks again! That was exactly what I needed!
Can this also be executed on transaction log files or can it only be used on data files?
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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.