<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>Code Library - SQL</title>
        <link>http://weblogs.sqlteam.com/jeffs/category/240.aspx</link>
        <description>Snippets of code, functions, stored procedures and more that you can generally cut and paste and use wherever you like.</description>
        <language>en-US</language>
        <copyright>Jeff Smith</copyright>
        <managingEditor>smith_jeffreyt@yahoo.com</managingEditor>
        <generator>Subtext Version 1.9.4.0</generator>
        <item>
            <title>SQL Server Express Automated Backups</title>
            <link>http://weblogs.sqlteam.com/jeffs/archive/2007/12/06/sql-express-backups.aspx</link>
            <description>I recently set up a web application using &lt;a href="http://www.microsoft.com/sql/editions/express/default.mspx" target="_blank"&gt;SQL Server Express&lt;/a&gt; for a client, and it was the first time I had done any "production" level work using the Express edition. As such, this was the first time I ever needed to configure automated backups for a SQL Express database.  However, there is no built-in way to schedule backups without using manual scripts or external applications.  I briefly toyed with writing something myself to get the job done, but of course we should not reinvent the wheel so I turned to &lt;a href="http://www.google.com/search?q=sql+express+backups" target="_blank"&gt;Google&lt;/a&gt; to find out what's out there for options. &lt;br /&gt;
&lt;br /&gt;
After much searching, here's the solution I went with:  Jasper Smith (no relation!) has written an extremely useful and powerful stored procedure called &lt;a href="http://www.sqldbatips.com/showarticle.asp?ID=27" target="_blank"&gt;expressmaint&lt;/a&gt; that handles backups, generates reports, performs validation, removes old files, and has many other options and features.  It's very complete and very easy to use.  In addition to the stored procedure, he provides an &lt;a href="http://www.sqldbatips.com/showarticle.asp?ID=29" target="_blank"&gt;expressmaint application&lt;/a&gt; that does the same thing but completely from the command line.  All you need to do is schedule the execution of either of these with Windows Task Scheduler and you are good to go.  He provides complete source code and has many examples.&lt;br /&gt;
&lt;br /&gt;
I found lots of examples of scripts out there to perform backups, but none of them had features like retaining backups or reports for custom durations, and none were as easy to use and configure and as flexible as the expressmaint solutions.  &lt;br /&gt;
&lt;br /&gt;
Thanks, Jasper, and well done!&lt;br /&gt;
&lt;br /&gt;
Also, don't forget that &lt;a href="http://weblogs.sqlteam.com/mladenp/Default.aspx" target="_blank"&gt;Mladen&lt;/a&gt; right here a &lt;a href="http://www.sqlteam.com" target="_blank"&gt;SQLTeam&lt;/a&gt; has &lt;a href="http://weblogs.sqlteam.com/mladenp/archive/2007/11/20/Free-SQL-Server-tools-that-might-make-your-life-a.aspx" target="_blank"&gt;a great post with lots of free SQL Server tools&lt;/a&gt; that you may find useful, and some of them may even provide scheduled backups for SQL Express.  (I haven't checked them all out yet)&lt;br /&gt;
&lt;br /&gt;
Are there any other free products or simple solutions out there for SQL Express developers that you've used? Any free GUI solutions out there?&lt;img src="http://weblogs.sqlteam.com/jeffs/aggbug/60419.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Jeff Smith</dc:creator>
            <guid>http://weblogs.sqlteam.com/jeffs/archive/2007/12/06/sql-express-backups.aspx</guid>
            <pubDate>Thu, 06 Dec 2007 20:10:00 GMT</pubDate>
            <wfw:comment>http://weblogs.sqlteam.com/jeffs/comments/60419.aspx</wfw:comment>
            <comments>http://weblogs.sqlteam.com/jeffs/archive/2007/12/06/sql-express-backups.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://weblogs.sqlteam.com/jeffs/comments/commentRss/60419.aspx</wfw:commentRss>
            <trackback:ping>http://weblogs.sqlteam.com/jeffs/services/trackbacks/60419.aspx</trackback:ping>
        </item>
        <item>
            <title>Hamming Distance Algorithm in SQL</title>
            <link>http://weblogs.sqlteam.com/jeffs/archive/2007/05/09/60197.aspx</link>
            <description>Here's a simple User-Defined Function implementation of the Hamming Distance Algorithm for SQL Server, useful for tracking down transposition errors in your data.
&lt;br&gt;
&lt;br&gt;
&lt;a href="http://weblogs.sqlteam.com/jeffs/archive/2007/05/09/60197.aspx"&gt;read more...&lt;/a&gt;&lt;img src="http://weblogs.sqlteam.com/jeffs/aggbug/60197.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Jeff Smith</dc:creator>
            <guid>http://weblogs.sqlteam.com/jeffs/archive/2007/05/09/60197.aspx</guid>
            <pubDate>Wed, 09 May 2007 14:39:51 GMT</pubDate>
            <comments>http://weblogs.sqlteam.com/jeffs/archive/2007/05/09/60197.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://weblogs.sqlteam.com/jeffs/comments/commentRss/60197.aspx</wfw:commentRss>
            <trackback:ping>http://weblogs.sqlteam.com/jeffs/services/trackbacks/60197.aspx</trackback:ping>
        </item>
        <item>
            <title>Essential SQL Server Date, Time and DateTime Functions</title>
            <link>http://weblogs.sqlteam.com/jeffs/archive/2007/01/02/56079.aspx</link>
            <description>I've posted some variations of these before, but here they all are in 1 easy package:  The essential date and time functions that every SQL Server database should have to ensure that you can easily manipulate dates and times without the need for any formatting considerations at all.
&lt;br&gt;
&lt;br&gt;
&lt;a href="http://weblogs.sqlteam.com/jeffs/archive/2007/01/02/56079.aspx"&gt;read more...&lt;/a&gt;&lt;img src="http://weblogs.sqlteam.com/jeffs/aggbug/56079.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Jeff Smith</dc:creator>
            <guid>http://weblogs.sqlteam.com/jeffs/archive/2007/01/02/56079.aspx</guid>
            <pubDate>Tue, 02 Jan 2007 16:38:46 GMT</pubDate>
            <comments>http://weblogs.sqlteam.com/jeffs/archive/2007/01/02/56079.aspx#feedback</comments>
            <slash:comments>54</slash:comments>
            <wfw:commentRss>http://weblogs.sqlteam.com/jeffs/comments/commentRss/56079.aspx</wfw:commentRss>
            <trackback:ping>http://weblogs.sqlteam.com/jeffs/services/trackbacks/56079.aspx</trackback:ping>
        </item>
        <item>
            <title>Another Dynamic SQL CrossTab Stored Procedure</title>
            <link>http://weblogs.sqlteam.com/jeffs/archive/2005/05/02/4842.aspx</link>
            <description>First off, before going any further make sure you have read the hall of fame SQLTeam article by Rob Volk on generating crosstab results using a flexible, dynamic stored procedure that has been viewed over 100,000 times!  &lt;br&gt;&lt;br&gt;&lt;a href="http://weblogs.sqlteam.com/jeffs/archive/2005/05/02/4842.aspx"&gt;read more...&lt;/a&gt;&lt;img src="http://weblogs.sqlteam.com/jeffs/aggbug/4842.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Jeff Smith</dc:creator>
            <guid>http://weblogs.sqlteam.com/jeffs/archive/2005/05/02/4842.aspx</guid>
            <pubDate>Mon, 02 May 2005 18:00:00 GMT</pubDate>
            <comments>http://weblogs.sqlteam.com/jeffs/archive/2005/05/02/4842.aspx#feedback</comments>
            <slash:comments>51</slash:comments>
            <wfw:commentRss>http://weblogs.sqlteam.com/jeffs/comments/commentRss/4842.aspx</wfw:commentRss>
            <trackback:ping>http://weblogs.sqlteam.com/jeffs/services/trackbacks/4842.aspx</trackback:ping>
        </item>
        <item>
            <title>Date Only and Time Only User Defined Dataypes in SQL Server 2000</title>
            <link>http://weblogs.sqlteam.com/jeffs/archive/2004/12/02/2959.aspx</link>
            <description>I talked about separating dates from times for certain columns in your database.  One thing I have never really used before in SQL Server 2000 is user-defined datatypes and rules.  Rules are like CHECK constraints, but from what I understand they are very non-standard. &lt;br&gt;&lt;br&gt;
&lt;a href="http://weblogs.sqlteam.com/jeffs/archive/2004/12/02/2959.aspx"&gt;read more...&lt;/a&gt;&lt;img src="http://weblogs.sqlteam.com/jeffs/aggbug/2959.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Jeff Smith</dc:creator>
            <guid>http://weblogs.sqlteam.com/jeffs/archive/2004/12/02/2959.aspx</guid>
            <pubDate>Thu, 02 Dec 2004 19:41:00 GMT</pubDate>
            <comments>http://weblogs.sqlteam.com/jeffs/archive/2004/12/02/2959.aspx#feedback</comments>
            <slash:comments>5</slash:comments>
            <wfw:commentRss>http://weblogs.sqlteam.com/jeffs/comments/commentRss/2959.aspx</wfw:commentRss>
            <trackback:ping>http://weblogs.sqlteam.com/jeffs/services/trackbacks/2959.aspx</trackback:ping>
        </item>
        <item>
            <title>Searching a column for all words, any words, or exact phrase in a SQL Table</title>
            <link>http://weblogs.sqlteam.com/jeffs/archive/2004/11/02/2460.aspx</link>
            <description>Here's one way to implement a search, similar to Google's, if you don't want to (or can't) use full text indexing. This allows you to pass a string of words, and indicate that either ALL words must match, ANY must match, or the exact string must match.&lt;img src="http://weblogs.sqlteam.com/jeffs/aggbug/2460.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Jeff Smith</dc:creator>
            <guid>http://weblogs.sqlteam.com/jeffs/archive/2004/11/02/2460.aspx</guid>
            <pubDate>Tue, 02 Nov 2004 20:35:00 GMT</pubDate>
            <comments>http://weblogs.sqlteam.com/jeffs/archive/2004/11/02/2460.aspx#feedback</comments>
            <slash:comments>19</slash:comments>
            <wfw:commentRss>http://weblogs.sqlteam.com/jeffs/comments/commentRss/2460.aspx</wfw:commentRss>
            <trackback:ping>http://weblogs.sqlteam.com/jeffs/services/trackbacks/2460.aspx</trackback:ping>
        </item>
        <item>
            <title>More aggregate SQL functions</title>
            <link>http://weblogs.sqlteam.com/jeffs/archive/2004/07/11/1744.aspx</link>
            <description>Despite the cool things you can do with writing your own custom aggregate functions as shown in my last article, in many cases you don't need custom functions to get what you need.  This should answer some of the questions raised in the comments from my article. &lt;br&gt;&lt;br&gt; &lt;A href="http://weblogs.sqlteam.com/jeffs/archive/2004/07/11/1744.aspx"&gt;more...&lt;/a&gt;&lt;img src="http://weblogs.sqlteam.com/jeffs/aggbug/1744.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Jeff Smith</dc:creator>
            <guid>http://weblogs.sqlteam.com/jeffs/archive/2004/07/11/1744.aspx</guid>
            <pubDate>Mon, 12 Jul 2004 02:12:00 GMT</pubDate>
            <comments>http://weblogs.sqlteam.com/jeffs/archive/2004/07/11/1744.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://weblogs.sqlteam.com/jeffs/comments/commentRss/1744.aspx</wfw:commentRss>
            <trackback:ping>http://weblogs.sqlteam.com/jeffs/services/trackbacks/1744.aspx</trackback:ping>
        </item>
        <item>
            <title>Efficient paging of recordsets: SQL Server 2000</title>
            <link>http://weblogs.sqlteam.com/jeffs/archive/2003/12/22/672.aspx</link>
            <description>Here's the most efficient way that I can think of  to return rows @a through @b from a table or query, when each row is ordered and can be uniquely identified by a set of columns, in SQL 2000.&lt;br&gt;&lt;br&gt;&lt;a href="http://weblogs.sqlteam.com/jeffs/archive/2003/12/22/672.aspx"&gt;more...&lt;/a&gt;&lt;img src="http://weblogs.sqlteam.com/jeffs/aggbug/672.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Jeff Smith</dc:creator>
            <guid>http://weblogs.sqlteam.com/jeffs/archive/2003/12/22/672.aspx</guid>
            <pubDate>Mon, 22 Dec 2003 17:31:00 GMT</pubDate>
            <comments>http://weblogs.sqlteam.com/jeffs/archive/2003/12/22/672.aspx#feedback</comments>
            <slash:comments>28</slash:comments>
            <wfw:commentRss>http://weblogs.sqlteam.com/jeffs/comments/commentRss/672.aspx</wfw:commentRss>
            <trackback:ping>http://weblogs.sqlteam.com/jeffs/services/trackbacks/672.aspx</trackback:ping>
        </item>
        <item>
            <title>Create a Date in T-SQL</title>
            <link>http://weblogs.sqlteam.com/jeffs/archive/2003/12/15/657.aspx</link>
            <description>Another way to create dates easily, w/o using CONVERT or using a UDF (i.e., if you have SQL 7.0), if you are starting out with integers representing the year, month and day of the date you need to create:
&lt;br&gt;&lt;br&gt;&lt;a href="http://weblogs.sqlteam.com/jeffs/archive/2003/12/15/657.aspx"&gt;read more...&lt;/a&gt;&lt;img src="http://weblogs.sqlteam.com/jeffs/aggbug/657.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Jeff Smith</dc:creator>
            <guid>http://weblogs.sqlteam.com/jeffs/archive/2003/12/15/657.aspx</guid>
            <pubDate>Mon, 15 Dec 2003 15:07:00 GMT</pubDate>
            <comments>http://weblogs.sqlteam.com/jeffs/archive/2003/12/15/657.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://weblogs.sqlteam.com/jeffs/comments/commentRss/657.aspx</wfw:commentRss>
            <trackback:ping>http://weblogs.sqlteam.com/jeffs/services/trackbacks/657.aspx</trackback:ping>
        </item>
        <item>
            <title>PARSENAME() - a simple way to parse (some) strings in SQL</title>
            <link>http://weblogs.sqlteam.com/jeffs/archive/2003/09/30/195.aspx</link>
            <description>Handy reminder: The PARSENAME() function can be useful for parsing small strings.  It returns parts 1-4 (working right to left) of a string, with each part delimited by periods.
&lt;br&gt;&lt;br&gt;&lt;a href="http://weblogs.sqlteam.com/jeffs/archive/2003/09/30/195.aspx"&gt;read more...&lt;/a&gt;&lt;img src="http://weblogs.sqlteam.com/jeffs/aggbug/195.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Jeff Smith</dc:creator>
            <guid>http://weblogs.sqlteam.com/jeffs/archive/2003/09/30/195.aspx</guid>
            <pubDate>Tue, 30 Sep 2003 21:09:00 GMT</pubDate>
            <comments>http://weblogs.sqlteam.com/jeffs/archive/2003/09/30/195.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://weblogs.sqlteam.com/jeffs/comments/commentRss/195.aspx</wfw:commentRss>
            <trackback:ping>http://weblogs.sqlteam.com/jeffs/services/trackbacks/195.aspx</trackback:ping>
        </item>
    </channel>
</rss>