Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

merge two physical data files

Status
Not open for further replies.

Glowworm27

Programmer
May 30, 2003
587
US
Hello all,

I was wondering, if you have a database with two physical data files a 'PRIMARY' and a 'SECONDARY', and one log file
can you merge the data files? the 'PRIMARY' and 'SECONDARY' into one 'PRIMARY' file?

if so how.

George Oakes
Check out this awsome .Net Resource!
 
I Think you can. What makes primary and secondary is just tables or index or whatever you have stored on teh secondary. You should be able to move them over to the priamary, then delete the Secondary.

However, you do i believe have to drop and recreate them(your tables, indexs etc) from scratch. I dont think you can just move them over to it. Perhaps someone else who has done them before has more knowlege on it.
 
do a dbcc shrinkfile with emptyfile then you can do a alter database to drop the file.

======================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
 
Moving the indexes only works if the files are in different filegroups.
You can rebuild the index specifying the filegroup. To move the data rebuild the clustered index (or create one if it isn't there) - do the clustered index first.

======================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top