{"id":77,"date":"2010-12-06T11:16:15","date_gmt":"2010-12-06T18:16:15","guid":{"rendered":"http:\/\/www.sqldbpros.com\/?p=77"},"modified":"2010-12-06T11:28:41","modified_gmt":"2010-12-06T18:28:41","slug":"sql-server-combine-mdf-files-the-easy-way","status":"publish","type":"post","link":"http:\/\/sqldbpros.com\/wordpress\/2010\/12\/sql-server-combine-mdf-files-the-easy-way\/","title":{"rendered":"SQL Server Combine MDF Files &#8211; The Easy Way"},"content":{"rendered":"<p>Do you need to combine or merge two data files (MDF or NDF)?\u00a0 There are a number of complicated options available or you can use the two lines of code below to do the trick... It's up to you.\u00a0 This method works with both SQL Server 2005 and SQL Server 2008.<!--more--><\/p>\n<blockquote><p>USE DataBaseName<br \/>\nGO<\/p>\n<p>DBCC SHRINKFILE(LogicalNameOfFileToRemove, EMPTYFILE)<br \/>\nALTER DATABASE DataBaseName REMOVE FILE LogicalNameOfFileToRemove<\/p><\/blockquote>\n<p>If you don't know the logical name of your MS SQL Server files use the following T-SQL query:<\/p>\n<blockquote><p>SELECT<br \/>\nname AS LogicalName<br \/>\n,sys.database_files.physical_name AS PhysicalName<br \/>\nFROM<br \/>\nsys.database_files<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>Do you need to combine or merge two data files (MDF or NDF)?\u00a0 There are a number of complicated options available or you can use the two lines of code below to do the trick... It's up to you.\u00a0 This method works with both SQL Server 2005 and SQL Server 2008.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[16,14,10,15,6,9,12,11],"class_list":["post-77","post","type-post","status-publish","format-standard","hentry","category-scripts","tag-files","tag-mdf","tag-ms-sql","tag-ndf","tag-script","tag-sql-server","tag-sql-server-2005","tag-sql-server-2008"],"_links":{"self":[{"href":"http:\/\/sqldbpros.com\/wordpress\/wp-json\/wp\/v2\/posts\/77","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/sqldbpros.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/sqldbpros.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/sqldbpros.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/sqldbpros.com\/wordpress\/wp-json\/wp\/v2\/comments?post=77"}],"version-history":[{"count":4,"href":"http:\/\/sqldbpros.com\/wordpress\/wp-json\/wp\/v2\/posts\/77\/revisions"}],"predecessor-version":[{"id":81,"href":"http:\/\/sqldbpros.com\/wordpress\/wp-json\/wp\/v2\/posts\/77\/revisions\/81"}],"wp:attachment":[{"href":"http:\/\/sqldbpros.com\/wordpress\/wp-json\/wp\/v2\/media?parent=77"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/sqldbpros.com\/wordpress\/wp-json\/wp\/v2\/categories?post=77"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/sqldbpros.com\/wordpress\/wp-json\/wp\/v2\/tags?post=77"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}