﻿<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Database Files</title>
    <description>Database Files</description>
    <link>http://www.dbalinks.com/Home/tabid/36/BlogId/390/Default.aspx</link>
    <language>en-US</language>
    <webMaster>admin@dbalinks.com</webMaster>
    <pubDate>Sat, 04 Sep 2010 16:49:17 GMT</pubDate>
    <lastBuildDate>Sat, 04 Sep 2010 16:49:17 GMT</lastBuildDate>
    <docs>http://backend.userland.com/rss</docs>
    <generator>Blog RSS Generator Version 3.3.0.16726</generator>
    <item>
      <title>Truncating a data file</title>
      <description>&lt;p&gt;Truncating a data file&lt;/p&gt;
&lt;div class="subSection"&gt;
&lt;p&gt;The following example truncates the primary data file in the &lt;tt&gt;AdventureWorks&lt;/tt&gt; database. The &lt;tt&gt;sys.database_files&lt;/tt&gt; catalog view is queried to obtain the &lt;tt&gt;file_id&lt;/tt&gt; of the data file.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/ms189493.aspx"&gt;http://msdn2.microsoft.com/en-us/library/ms189493.aspx&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;USE AdventureWorks;&lt;br /&gt;
GO&lt;br /&gt;
SELECT file_id, name&lt;br /&gt;
FROM sys.database_files;&lt;br /&gt;
GO&lt;br /&gt;
DBCC SHRINKFILE (1, TRUNCATEONLY);&lt;/p&gt;</description>
      <link>http://www.dbalinks.com/Home/tabid/36/EntryID/328/Default.aspx</link>
      <comments>http://www.dbalinks.com/Home/tabid/36/EntryID/328/Default.aspx#Comments</comments>
      <guid isPermaLink="true">http://www.dbalinks.com/Default.aspx?tabid=36&amp;EntryID=328</guid>
      <pubDate>Wed, 15 Oct 2008 10:40:08 GMT</pubDate>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://www.dbalinks.com/DesktopModules/Blog/Trackback.aspx?id=328</trackback:ping>
    </item>
    <item>
      <title>How to empty a database file - Emptying a file</title>
      <description>&lt;p&gt;Emptying a file&lt;/p&gt;
&lt;div class="subSection"&gt;
&lt;p&gt;The following example demonstrates the procedure for emptying a file so that it can be removed from the database. For the purposes of this example, a data file is first created and it is assumed that the file contains data.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/ms189493.aspx"&gt;http://msdn2.microsoft.com/en-us/library/ms189493.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;USE AdventureWorks;&lt;br /&gt;
GO&lt;br /&gt;
-- Create a data file and assume it contains data.&lt;br /&gt;
ALTER DATABASE AdventureWorks &lt;br /&gt;
ADD FILE (&lt;br /&gt;
    NAME = Test1data,&lt;br /&gt;
    FILENAME = 'C:\t1data.ndf',&lt;br /&gt;
    SIZE = 5MB&lt;br /&gt;
    );&lt;br /&gt;
GO&lt;br /&gt;
-- Empty the data file.&lt;br /&gt;
DBCC SHRINKFILE ('Test1data', EMPTYFILE);&lt;br /&gt;
GO&lt;br /&gt;
-- Remove the data file from the database.&lt;br /&gt;
ALTER DATABASE AdventureWorks&lt;br /&gt;
REMOVE FILE Test1data;&lt;br /&gt;
GO&lt;/p&gt;
&lt;/div&gt;</description>
      <link>http://www.dbalinks.com/Home/tabid/36/EntryID/327/Default.aspx</link>
      <comments>http://www.dbalinks.com/Home/tabid/36/EntryID/327/Default.aspx#Comments</comments>
      <guid isPermaLink="true">http://www.dbalinks.com/Default.aspx?tabid=36&amp;EntryID=327</guid>
      <pubDate>Wed, 15 Oct 2008 10:40:08 GMT</pubDate>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://www.dbalinks.com/DesktopModules/Blog/Trackback.aspx?id=327</trackback:ping>
    </item>
  </channel>
</rss>