> What is the best method to delete the secondary datafile and
> add that much space to primary datafile.
1. Make sure the primary file can accomodate the data. Expand if neccesary. Something like
ALTER DATATBASE dbname MODIFY FILE (name = logical_filename, size = xGB)
2. Empty the secondary file. Use DBCC SHRINKFILE and the EMPTYFILE option.
3. Remove that now empty file from the database:
ALTER DATABASE dbname REMOVE FILE logical_file_name

Signature
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
> SQL server 2000 sp3
> Hi
[quoted text clipped - 9 lines]
> with 450 gb). What is the best method to delete the secondary datafile and
> add that much space to primary datafile.
bass_player - 19 Mar 2008 09:08 GMT
I'm just curious as to what happens when you empty the database files
>> What is the best method to delete the secondary datafile and
>> add that much space to primary datafile.
[quoted text clipped - 29 lines]
>> and
>> add that much space to primary datafile.
Tibor Karaszi - 19 Mar 2008 10:31 GMT
DBCC SHRINKFILE using the EMPTYFILE option will "push" pages over to other file, causing them to
autogrow if they can't accommodate this. These operation is logged so one need to be very cautious
with the transaction log if lots of pages will be "moved" to other files.

Signature
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
> I'm just curious as to what happens when you empty the database files
>
[quoted text clipped - 22 lines]
>>> with 450 gb). What is the best method to delete the secondary datafile and
>>> add that much space to primary datafile.
db - 19 Mar 2008 16:41 GMT
Thanks Tibor.
Bass: In my case pages were not moved as the secondary file was empty, and
file was deleted.

Signature
ontario, canada
> DBCC SHRINKFILE using the EMPTYFILE option will "push" pages over to other file, causing them to
> autogrow if they can't accommodate this. These operation is logged so one need to be very cautious
[quoted text clipped - 26 lines]
> >>> with 450 gb). What is the best method to delete the secondary datafile and
> >>> add that much space to primary datafile.