<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://sqlblog.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>The Rambling DBA: Jonathan Kehayias : Compression</title><link>http://sqlblog.com/blogs/jonathan_kehayias/archive/tags/Compression/default.aspx</link><description>Tags: Compression</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP2 (Build: 61129.1)</generator><item><title>Enabling Data Compression On All Tables By Default in a SQL Server 2008 Database</title><link>http://sqlblog.com/blogs/jonathan_kehayias/archive/2009/02/24/enabling-data-compression-on-all-tables-by-default-in-a-sql-server-2008-database.aspx</link><pubDate>Tue, 24 Feb 2009 16:35:24 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:12146</guid><dc:creator>Jonathan Kehayias</dc:creator><slash:comments>11</slash:comments><comments>http://sqlblog.com/blogs/jonathan_kehayias/comments/12146.aspx</comments><wfw:commentRss>http://sqlblog.com/blogs/jonathan_kehayias/commentrss.aspx?PostID=12146</wfw:commentRss><description>&lt;p&gt;One of the great things about answering questions online is that every now and then you get one of those Aha! moments and you create a solution to a problem that once written seems really obvious and makes you wonder how that ever escaped you previously. This happened recently on the MSDN Forums, but in this case it wasn't my Aha! moment, it was Aaron Alton's in a follow up response he posted behind me.&amp;#160; The question asked was:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;em&gt;&amp;quot;Is there a way to set the default compression level for all tables created in a database?&amp;quot;&amp;#160; &lt;/em&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;I misread the question initially and thought that it was a two part question, first asking if it could be set by default and then if not, could it be changed afterwards, so I responded with how to alter the table and indexes afterwards since there isn't a default option to set it for all tables.&amp;#160; Later Aaron replied how to use a DDL Trigger to automagically add Database Compression to all tables.&amp;#160; He followed up today with a blog post titled:&lt;/p&gt;  &lt;blockquote&gt;   &lt;h5&gt;&lt;a href="http://thehobt.blogspot.com/2009/02/enabling-data-compression-by-default-in.html"&gt;Enabling Data Compression By Default in a SQL Server 2008 Database&lt;/a&gt;&lt;/h5&gt; &lt;/blockquote&gt;  &lt;p&gt;Its an interesting solution to the problem posed by the original poster, and when I read it in the forums, my first thought was Duh!&amp;#160; Why in the world didn't that cross my mind?&amp;#160; I'll never know but it was definitely a Aha! type of thing.&amp;#160; There are some caveats to this solution, which you can read about in his blog post, or on the original forums thread:&lt;/p&gt;  &lt;p&gt;&lt;a title="Is there a way to set the default compression level for all tabl" href="http://social.msdn.microsoft.com/Forums/en-US/sqldatabaseengine/thread/f497b091-6aa2-42a2-8206-ceef1f95e229"&gt;Is there a way to set the default compression level for all tables created in a database?&lt;/a&gt;&lt;/p&gt;&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=12146" width="1" height="1"&gt;</description><category domain="http://sqlblog.com/blogs/jonathan_kehayias/archive/tags/Compression/default.aspx">Compression</category><category domain="http://sqlblog.com/blogs/jonathan_kehayias/archive/tags/Database+Administration/default.aspx">Database Administration</category><category domain="http://sqlblog.com/blogs/jonathan_kehayias/archive/tags/SQL+Server+2008/default.aspx">SQL Server 2008</category></item></channel></rss>