<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>Snipplr</title>
    <description>Recent snippets posted on Snipplr.com</description>
    <link>https://snipplr.com/</link>
    <lastBuildDate>Tue, 09 Jun 2026 13:10:38 +0000</lastBuildDate>
    <item>
      <title>(SQL) Suggest Indexes to Add - g8rpal</title>
      <link>https://snipplr.com/view/41489/suggest-indexes-to-add</link>
      <description>&lt;p&gt;&lt;/p&gt;</description>
      <pubDate>Tue, 05 Oct 2010 06:25:01 UTC</pubDate>
      <guid>https://snipplr.com/view/41489/suggest-indexes-to-add</guid>
    </item>
    <item>
      <title>(SQL) Index defrag script (21005/2008) - g8rpal</title>
      <link>https://snipplr.com/view/41197/index-defrag-script-210052008</link>
      <description>&lt;p&gt;It can either rebuild/reorg all databases or just a selected database. Options are there to prevent small indexes from being redone (there is not much point in rebuilding an idex with only a few pages). You can also prevent it from reindexing large indexes, one that you may prefer to do manually. If the edition of SQL supports it, it will do online rebuilds. You can also prevent index from being rebuilt that are over a certain threshold, either in pages or percentage (you may want to do manually large indexes manually). &#13;
&#13;
 &#13;
&#13;
You can set your own threshold for reorg versus rebuild (defaults to 5/30). There is also an option to change the recovery model to simple for the duration of the action.&#13;
&#13;
 &#13;
&#13;
The only time this may fail is if your server is case sensitive, I did not build in the checks to allow for that.&#13;
&#13;
 &#13;
&#13;
If you want to rebuild all indexes with a new fillfactor, just set the @ReOrgThreshold to 1.01 and @ReBuildThreshold to 1.02...or do it manually.&#13;
&#13;
 &#13;
&#13;
Not much else to add, the SP has a good bit of documentation.&lt;/p&gt;</description>
      <pubDate>Thu, 30 Sep 2010 22:56:49 UTC</pubDate>
      <guid>https://snipplr.com/view/41197/index-defrag-script-210052008</guid>
    </item>
    <item>
      <title>(SQL) Get daylight savings time - g8rpal</title>
      <link>https://snipplr.com/view/41196/get-daylight-savings-time</link>
      <description>&lt;p&gt;Many of us have come across cases where we need to convert a time (such as UTC) to local time, but what about those parts of the world where daylight savings time is observed?&#13;
&#13;
 &#13;
&#13;
This function will return the daylight savings date/time for a given year in accordance with historical records: http://www.energy.ca.gov/daylightsaving.html#chart&#13;
&#13;
 &#13;
&#13;
This way, no lookup tables are needed. All you have to know is what timezone you are converting from and to, because as long as you have the date when daylight savings begins/ends, then it should be fairly easy to write some case logic to convert the date. This script also contains an example of this function's use by converting UTC to PST.&#13;
&#13;
 &#13;
&#13;
Caveat: The function can return undesirable results if the SET DATEFIRST statement is set to anything other than Sunday.&lt;/p&gt;</description>
      <pubDate>Thu, 30 Sep 2010 22:55:30 UTC</pubDate>
      <guid>https://snipplr.com/view/41196/get-daylight-savings-time</guid>
    </item>
    <item>
      <title>(SQL) Delete duplicate rows from the table using row_number() - g8rpal</title>
      <link>https://snipplr.com/view/41195/delete-duplicate-rows-from-the-table-using-rownumber</link>
      <description>&lt;p&gt;To remove the duplicate rows from table we may have used several ways.&#13;
&#13;
In SQL Server 2005 has the feature to delete the duplicate rows within single query.&lt;/p&gt;</description>
      <pubDate>Thu, 30 Sep 2010 22:52:52 UTC</pubDate>
      <guid>https://snipplr.com/view/41195/delete-duplicate-rows-from-the-table-using-rownumber</guid>
    </item>
    <item>
      <title>(SQL) Script all Indexes - g8rpal</title>
      <link>https://snipplr.com/view/41194/script-all-indexes</link>
      <description>&lt;p&gt;This script will generate CREATE Index statements for all indexes in the database&lt;/p&gt;</description>
      <pubDate>Thu, 30 Sep 2010 22:50:42 UTC</pubDate>
      <guid>https://snipplr.com/view/41194/script-all-indexes</guid>
    </item>
    <item>
      <title>(SQL) Way to Check Multiple LIKE without dynamic SQL - g8rpal</title>
      <link>https://snipplr.com/view/41192/way-to-check-multiple-like-without-dynamic-sql</link>
      <description>&lt;p&gt;This uses CROSS APPLY and the fn_split() function to separate out parameters. The @vParam parameter stores your LIKE conditions, separated by commas.&#13;
By Atif-ullah Sheikh, 2010/09/16&lt;/p&gt;</description>
      <pubDate>Thu, 30 Sep 2010 22:39:08 UTC</pubDate>
      <guid>https://snipplr.com/view/41192/way-to-check-multiple-like-without-dynamic-sql</guid>
    </item>
    <item>
      <title>(SQL) List all columns in server - g8rpal</title>
      <link>https://snipplr.com/view/41191/list-all-columns-in-server</link>
      <description>&lt;p&gt;&lt;/p&gt;</description>
      <pubDate>Thu, 30 Sep 2010 22:27:02 UTC</pubDate>
      <guid>https://snipplr.com/view/41191/list-all-columns-in-server</guid>
    </item>
    <item>
      <title>(SQL) Autogenerate identity column via Select - g8rpal</title>
      <link>https://snipplr.com/view/40246/autogenerate-identity-column-via-select</link>
      <description>&lt;p&gt;&lt;/p&gt;</description>
      <pubDate>Fri, 10 Sep 2010 05:35:01 UTC</pubDate>
      <guid>https://snipplr.com/view/40246/autogenerate-identity-column-via-select</guid>
    </item>
    <item>
      <title>(SQL) Delete duplicate rows from the table using row_number() - g8rpal</title>
      <link>https://snipplr.com/view/40096/delete-duplicate-rows-from-the-table-using-rownumber</link>
      <description>&lt;p&gt;&lt;/p&gt;</description>
      <pubDate>Tue, 07 Sep 2010 21:43:04 UTC</pubDate>
      <guid>https://snipplr.com/view/40096/delete-duplicate-rows-from-the-table-using-rownumber</guid>
    </item>
    <item>
      <title>(SQL) Script all Foreign Key Constraints - Result Set can be used to DROP constraints for 'TableName' - g8rpal</title>
      <link>https://snipplr.com/view/39932/script-all-foreign-key-constraints--result-set-can-be-used-to-drop-constraints-for-tablename</link>
      <description>&lt;p&gt;&lt;/p&gt;</description>
      <pubDate>Fri, 03 Sep 2010 04:06:08 UTC</pubDate>
      <guid>https://snipplr.com/view/39932/script-all-foreign-key-constraints--result-set-can-be-used-to-drop-constraints-for-tablename</guid>
    </item>
    <item>
      <title>(SQL) Script all Foreign Key Constraints - Result Set can be used to copy constraints to your testing DB or to keep on hand in case of - g8rpal</title>
      <link>https://snipplr.com/view/39931/script-all-foreign-key-constraints--result-set-can-be-used-to-copy-constraints-to-your-testing-db-or-to-keep-on-hand-in-case-of</link>
      <description>&lt;p&gt;&lt;/p&gt;</description>
      <pubDate>Fri, 03 Sep 2010 04:00:30 UTC</pubDate>
      <guid>https://snipplr.com/view/39931/script-all-foreign-key-constraints--result-set-can-be-used-to-copy-constraints-to-your-testing-db-or-to-keep-on-hand-in-case-of</guid>
    </item>
    <item>
      <title>(SQL) SQL SERVER â€“ 2005 â€“ Find Tables With Foreign Key Constraint in Database - g8rpal</title>
      <link>https://snipplr.com/view/39930/sql-server--2005--find-tables-with-foreign-key-constraint-in-database</link>
      <description>&lt;p&gt;&lt;/p&gt;</description>
      <pubDate>Fri, 03 Sep 2010 03:52:46 UTC</pubDate>
      <guid>https://snipplr.com/view/39930/sql-server--2005--find-tables-with-foreign-key-constraint-in-database</guid>
    </item>
    <item>
      <title>(SQL) only select date part from datetime - g8rpal</title>
      <link>https://snipplr.com/view/39757/only-select-date-part-from-datetime</link>
      <description>&lt;p&gt;&lt;/p&gt;</description>
      <pubDate>Tue, 31 Aug 2010 21:55:32 UTC</pubDate>
      <guid>https://snipplr.com/view/39757/only-select-date-part-from-datetime</guid>
    </item>
  </channel>
</rss>
